I've used multi-threading a lot, while appending to the same list from different threads. Everything worked fine.
However, I'm getting a problem with list appending when the threads are like 70 threads or more. Appending in the last thread gets stuck for like 5 mins (the processor is not occubied at this time, maybe 10 %. So, it's not a hardware problem I would say). Then appending occurs successfully.
At this link, it says that list appending is thread-safe.
My question is: Can list appending ever become not thread safe?
Don't ask for a code or so. I just need a simple yes or no to my question. And if yes, kindly provide suggestions to fix that.
list appending in python is thread safe.
For more details: what kinds of global value mutation are thread safe
You last thread gets stuck maybe due to other reason, for example: Memory allocating..
My first step to fix the stuck is use strace to trace the syscall.
And you can use gdb to print all threads' call stack too. Here is a wiki page: https://wiki.python.org/moin/DebuggingWithGdb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With