当前位置:网站首页>Multi process pit records (updated from time to time)
Multi process pit records (updated from time to time)
2022-06-21 15:45:00 【Dai Meng Ma】
1. Deadlocks caused by business logic
This is the most common , But just sort out the logic , This is not easy to happen , But pay attention to : It is best not to define a variable manually , To determine whether a synchronization lock is required .
- such as : Define a variable
needLockFuncorhas_lock_funcsuch , Then, to prevent deadlock, judge that the variable is True or False, Where useful in subsequent logic , And then judge the variables , Manually set to... If necessary True, Run out set to False. After the periodic coding , The probability forgets this variable ! Just dig a hole for yourself
2. Subprocess cannot find variable
There are no variables defined in various parent processes in the child process , The subprocess is usually written as a function , Then multiple processes run this function , Many mistakes can be avoided , But there are still some things to be aware of :
- For example, the user-defined log module is used , But there is no such thing in the subprocess logger, Will result in the use of logger I'm going to report an error , Subprocess cannot continue , But the error is reported in the log module , Therefore, the log module will not write errors to its own records . It's also true that the logs will eventually result , The process did not execute the results
3. Database connection timeout
It was created in the parent process Mysql Connection pool for database , After handing it over to the child process , This connection pool cannot be used when the child process needs to save data after processing , Because the connection of the connection pool is created but not used for a long time Mysql Will actively disconnect this link , If the fruiting process is unlucky, a disconnected connection will be reported Error Code: 2013. Lost connection to MySQL server during query The error of . So it is best to create a connection in the child process when the child process needs to use the database , Don't use the parent process as a baton , The function division is based on the function .
边栏推荐
- 原生JS路由,iframe框架
- 2020-11-12 meter skipping
- ConnectionOptions. Username attribute definition
- Stm32l431 immediate sleep mode (code + explanation)
- Factorial summation
- [redis] basic operation of key
- Not only products, FAW Toyota can give you "all-round" peace of mind
- Merge two ordered linked lists
- Three disciplines of elastic design, how to make the stability KPI high?
- [North Asia data recovery] SQLSERVER database encrypted data recovery case sharing
猜你喜欢

Go language - Method

When Huawei order service is called to verify the token interface, connection reset is returned

Research Report on the overall scale, major producers, major regions, products and application segments of active aluminum chloride in the global market in 2022

去中心化游戏如何吸引传统玩家?

真香!十五分钟搞定智能标注、模型训练、服务部署……

Blazor概述和路由

GO语言-接口

TypeScript(6)函数

Basic concepts of database

Perfect partner of ebpf: cilium connected to cloud native network
随机推荐
Integration of sparkstreaming and sparksql
The out of the box caching function of angular server-side rendering applications
【数论】leetcode1006. Clumsy Factorial
2 万字 + 30 张图 | 细聊 MySQL undo log、redo log、binlog 有什么用?
Telnet batch test (II): key codes for the implementation of Telnet batch test script
Phantom star VR product details 32: Infinite War
Tomb. Weekly update of Finance (February 14-20)
Build an efficient and scalable result cache
Fluent encapsulates an immersive navigation bar with customizable styles NavigationBar
GO语言-type关键字
Daily practice (23): the first character that appears only once
[cicadaplayer] read and write of HLS stream
理财产品预约赎回确认日是什么?
加密市场「大逃杀」:清算、抛售、挤兑
Shared memory communication between processes
When Huawei order service is called to verify the token interface, connection reset is returned
Comprehensive learning notes for intermediate network engineer in soft test (nearly 40000 words)
GO语言-方法
H2O brings AI master NLP technology to enterprises
PLSQL learning log