-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with thread concurrency #515
Comments
Please post questions to the mailing list in the future. This seems to be a yet another case of #508, #386, #192, #188. Each If your code does not start threads that use Bunny channels per se, underlying servers, I/O libraries and so on can effectively create sharing. Channel continuations in Bunny are not that complicated and sequential for each channel. In your specific case, Myxi.channel is shared mutable state. Should it ever be invoked from different threads by the underlying server or I/O library, you will run into "overlapping" continuations (method A is invoked, then before a response for A arrives B is invoked, then a response for A arrives and B's caller is confused and calls an unexpected method). Either synchronise operations on |
I believe this may be a duplicate of #462. Will ensure I am running latest version before reporting bugs next time 🙁 |
@catphish honestly I don't see how this is a duplicate of #462. You have shared mutable state which is a |
As I mentioned on my original post, my application is single threaded. Is it not correct that this this shared channel would only be an issue if multiple threads were to access it simultaneously? This should be impossible as I only have one thread. I realise now that the title of this ticket is inappropriate and this may not be a thread related issue at all! It is also worth noting that after further digging in my logs, I found this exception, which is what lead me to look at #462
|
I explained above that your code may or may not start threads but you rely on HTTP servers and I/O libraries that might. This kind of issues is usually reported by Puma users. I have been answering it for years now. Try printing current thread ID, for example. Your other log does look like #462 but in a different place in your code (the line does not match what's in master but there's only one |
I do not appreciate when GitHub issues are used for discussions and speculations plus I believe this is answered in enough detail for the OP to take it from here => locking. |
I am having an issue with thread concurrency resulting in the same types of errors that many people receive when using threads incorrectly and data gets out of order:
I see from previous issues that many others have had this issue when attempting to use the same channel across multiple threads, however my application only has a single thread, plus the threads that Bunny itself creates.
My specific issue seems to be that I am running
subscribe
in my main application thread at the same time as Bunny is runningread_fully
in its transport thread.I don't know if I'm doing something I should not be from within a callback, or perhaps this is a bug. In either case any assistance would be appreciated. My complete code can be found at https://github.com/adamcooke/myxi/tree/master/lib/myxi
I hope the backtraces below provide the best possible information about this problem, but please let me know if there if anything else I can do to assist in debugging. Full backtrace of all threads at the time of the error:
...and another one:
Thanks!
The text was updated successfully, but these errors were encountered: