当前位置:网站首页>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 .
边栏推荐
- 階乘求和
- The application of RPC technology and its framework sekiro in crawler reverse, encrypting data is a shuttle!
- 微服务架构带来的分布式单体
- Brain: machine learning reveals two different neuroanatomical subtypes of schizophrenia
- 【数论】leetcode1006. Clumsy Factorial
- Algorithm question: interview question 32 - I. print binary tree from top to bottom (title + idea + code + comments) sequence traversal time and space 1ms to beat 97.84% of users once AC
- soEasyCheckin
- Unity grid programming 09
- [Yugong series] February 2022 wechat applet -app Subpackages and preloadrule of JSON configuration attribute
- C language pointer
猜你喜欢

鹅厂一面,有关 ThreadLocal 的一切

【数论】leetcode1006. Clumsy Factorial

After the uproar, is the yuan universe "cool"?

Non local network: early human attempts to tame transformer in CV | CVPR 2018

Phantom star VR product details 32: Infinite War

Gmail:如何跟踪邮件阅读状态

Go language - Method

“我这个白痴,招到了一堆只会‘谷歌’的程序员!”

soEasyCheckin

对Integer进行等值比较时踩到的一个坑
随机推荐
微服务架构带来的分布式单体
MQ interview questions sorting
Rk3399 platform development series explanation (network debugging) 7.33 network performance optimization
Link storage structure of simulated design disk file
【PyTorch基础教程29】DIN模型
Elastic stack Best Practices Series: a filebeat memory leak analysis and tuning
Browser evaluation: a free, simple and magical super browser - xiangtian browser
Stm32l431 immediate sleep mode (code + explanation)
【贪心】leetcode1005K次取反后数组后的最大值
AAAI 2022 | sasa: rethinking point cloud sampling in 3D object detection
Implementation of asynchronous request pool
Uniapp gets the height of the specified element div in the interface
Metric win computer application
What's wrong with the if judgment of pbootcms and the direct display of labels?
Angular 服务器端渲染应用的开箱即用的缓存功能问题
Score-Based Generative Modeling through Stochastic Differential Equations
SAP QM qs41 attempts to maintain a code group with a catalog of 3 and reports an error -you need to maintain catalog 3
对Integer进行等值比较时踩到的一个坑
GO语言-type关键字
Native JS routing, iframe framework