pyrollbar
pyrollbar copied to clipboard
Rollbar with Multiprocessing
Hi, I currently working on rollbar with multiprocessing but encounters a problem. POC here:
import rollbar
from multiprocessing import Process
def test():
rollbar.init("<post_server_token_here>")
print(rollbar.report_message("foo"))
if __name__ == "__main__":
p = Process(target=test)
p.start()
p.join()
When executing script with various python version, only python3.9 is working (Item created on rollbar dashboard)
❯ python2.7 a.py
ba97cff1-b03c-4eb7-a0c9-f7e4fcb5dfe1
❯ python3.6 a.py
WARNING:rollbar.lib._async:Python3.6 does not provide the `contextvars` module. Some advanced features may not work as expected. Please upgrade Python or install `aiocontextvars`.
75866ec2-b84b-4828-9339-152d4894b6d9
❯ python3.9 a.py
ac109c6a-c207-4b77-b192-5500a3109d4a
Rollbar Dashboard:

I think it's python version problem here.
After removing threading inside _send_payload_thread, everything works.
Hi @racterub thank you for bringing this to our attention with all the details and helpful context. The POC and results give a very clear representation of what is going on. Would you be willing to add a test and update the codebase, or would you like me to do that?
Hi @danielmorell Sorry for the late reply. I'm sorry I'm not familiar with unittest :(