Is raven thread and process safe?
See original GitHub issueWhen I test it with multi process, my server does not receive any message. I try to find the reason. It seems that the message go to the Queue, but cannot be picked out. In fact, although I config handler for each process, they use the same handler and the same transport object. The worker object block at Queue.get
method.
I config the handler like this in each process.
logger = logging.getLogger()
logger.handlers = []
client = Client(os.getenv('SENTRY_DSN'))
handler = SentryHandler(client)
handler.setLevel(logging.ERROR)
logger.addHandler(handler)
The worker object block at this statement. File: raven/transport/threaded.py Line 133, record = self._queue.get()
def _target(self):
while True:
record = self._queue.get() # This statement blocks.
try:
if record is self._terminator:
break
callback, args, kwargs = record
try:
callback(*args, **kwargs)
except Exception:
logger.error('Failed processing job', exc_info=True)
finally:
self._queue.task_done()
sleep(0)
Only the main process send the message successful. Btw, because, my raven version is 5.2.0.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:16 (4 by maintainers)
Top Results From Across the Web
9. Threads — Memory Pool System 1.117.0 documentation
Thread safety ¶. The MPS is designed to run in an environment with multiple threads all calling into the MPS. Some code is...
Read more >Thread Safety: Class Variables in Ruby - Stack Overflow
This is not actually true. The assumption that class instance variables are threadsafe is also untrue. Having a GIL doesn't make your code ......
Read more >Process-Safe in Python
Thread safety is a major concern of concurrent programming using threads. This is because threads have shared memory within the process, meaning ...
Read more >Safe as Life: A Four-Part Essay on Maggie Stiefvater's Raven ...
I: Safe as Life: Complex, Messy Love in The Raven Boys ... the halfway point of the novel where all of their separate...
Read more >PURE CANNABIS CONCENTRATE - Raven Grass
Our safe-solvent extraction uses >99% purity CO2 and leaves no residual solvent ... Our raw dehydration process purges moisture, yet leaves terpene and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry… I forgot there is a link… I thought they will work with it… In my code, I just write a init log function. This function will be called first in the new process.
Or you can simply don’t use log before fork process.
@jinzhao1994 Thank you so much for the help! Really appreciate it!