-
Notifications
You must be signed in to change notification settings - Fork 56
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
AccessViolationException in AsyncIO #12
Comments
I noticed this while tracking down access violations in my project. Interesting to see someone else with a similar problem. I believe this can happen if the socket is aborted while an overlapped IO is still in progress. The overlapped buffer gets marked as disposed, then freed and can be garbage collected before the Success field is checked. I made the following modifications, I haven't made a patch yet, because I am not convinced it is the source of my errors. My Windows.Overlapped.cs:
Note that CompletionPort.cs needs to also check I did something like this:
|
Would it be possible to path anyway if it's a clear error scenario? Thing is, this causes an exception from a background thread that takes down my entire application... I can't really catch it, so it's quite a big issue, only alternative I am seeing now is not running poller as async and instead permanently block a thread for it so I can run it in try/catch, which I don't like much... Or try NetMQ 4 which is no small deal and might not help anyway... |
I forked and created a pull request. I had trouble setting up the environment for the whole project on my box ((I have been using a private fork for my work because of this). If you'd like, you could use my fork of AsyncIO to test things out and see if it fixes your problem. This issue came up for me (I believe) when I had a heartbeat close non-responsive sockets while operations were still outstanding. |
Sorry, I couldn't test it as I'd hoped as I'm putting out several fires at once, I only know it happens very intermittently... And when I tried to replicate the scenario simply - connecting a socket, sending a frame with sendmore flag and then closing the server socket while a message has not finished receiving, I got a different exception, from NetMQ (also from a background thread so also quite bad): |
Is it possible to path this and release new version if I am not able to test the fix from my side? |
I believe you may be running into a separate issue I had, where on UWP, functions were returning failure from the socket API, but with an error code of SocketError.Success. Also, are you running NetMQ-3 or 4? I noticed you posted an issue under NetMQ-3. I am less familiar with 3, sorry. |
Hi, I am using NetMQ 4.0.0.1 and AsyncIO 0.1.26 and I am getting the AccessViolationException exception: Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. My application would close the NETMQ socket on idle and then reopen if new data has to be transmitted and I see this exception causing the application to crash once in a while. @southie / @somdoron , can you please confirm if the fix is part of the 0.1.26 version of AsyncIO. Github shows the fix being commited on Apr 29 and the 0.1.26 version was actually released on Jul 18 Regards, |
i think it was included but I think i still see a problem. I can try and provide a fix, would you be able to test it? |
sorry, it was not included, it was april this year, version released last year. |
That would be great. I have trouble building the source with Visual Studio 2017 (some targetframework not getting recognized and processor architecture mismatch errors). I will try to resolve the build issues and try the fix. If I am not successful, I will take the fix after you make the release next week. Thanks a lot @somdoron ! |
@pnrajesh new AsyncIO version released. |
Hi @somdoron Exception : Could not load file or assembly 'AsyncIO, Version=0.1.25.0' |
I know you're focusing mostly on NetMQ4, but there be any chance of releasing a NetmQ 3 version that can actually upgrade AsyncIO? I cannot get any of these fixes as current NetMQ 3 has somewhere baked in dependency on AsyncIO 0.1.20.0, I tried everything, redirect doesn't work, editing the package dependency doesn't help... I would appreciate much if NetMQ could use the latest AsyncIO. |
If you are using NetMQ version 3 I can give you a permission in nuget and
you can release a new version.
…On Nov 16, 2017 5:50 PM, "msykora" ***@***.***> wrote:
I know you're focusing mostly on NetMQ4, but there be any chance of
releasing a NetmQ 3 version that can actually upgrade AsyncIO? I cannot get
any of these fixes as current NetMQ 3 has somewhere baked in dependency on
AsyncIO 0.1.20.0, I tried everything, redirect doesn't work, editing the
package dependency doesn't help... I would appreciate much if NetMQ could
use the latest AsyncIO.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AClv9t09X0PluTrQYwDfzbu5wVbgMBhqks5s3Fm8gaJpZM4M4oF0>
.
|
OK I can do that :) |
What is you email? please note it is the same package as v4, so make sure
to use correct version.
…On Nov 16, 2017 19:54, "msykora" ***@***.***> wrote:
OK I can do that :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AClv9kY_fqoWW1oQPUh2Uu2B5hCF1H1bks5s3Ha9gaJpZM4M4oF0>
.
|
Actually I need a nuget username.
…On Thu, Nov 16, 2017, 20:37 msykora ***@***.***> wrote:
***@***.***
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AClv9kF0XJ7KhbZzKTLAAQNJRtDOMG5Uks5s3IDugaJpZM4M4oF0>
.
|
siki |
I would need to make a pull request for NetMQ 3 though, right? |
Yes
On Nov 16, 2017 21:01, "msykora" <[email protected]> wrote:
I would need to make a pull request for NetMQ 3 though, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AClv9qvmV6qxEXd557XaaY8Chi_7MGayks5s3IY4gaJpZM4M4oF0>
.
|
Hhmm can't update to AsyncIO since part of NetMQ targets framework 3.5. Should I just leave that part on the old AsyncIO? BTW not all unit tests are passing :-( how can I determine updating to AsyncIO 1.40 won't break anything when I can't trust the tests? |
Is the 3.5 NetMQ still relevant? If it is in the same nuget package and has the same nuspec, I can't set the dependency to AsyncIO 1.40... Would you be OK with releasing a new NetMQ package 3.3.3.5 with only the 4.0 target and newest AsyncIO? |
Tried to push a branch to remote but I don't have rights :) |
So how can I make that pull request? |
Hello,
I get this intermittently when I'm trying to load test my communication component based on NetMQ 3.3.3.4, sending messages from thousands of router sockets on a single machine, connected to a single router socket on the "server":
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Runtime.InteropServices.Marshal.ReadInt32(IntPtr ptr, Int32 ofs)
at AsyncIO.Windows.Overlapped.get_Success()
at AsyncIO.Windows.CompletionPort.HandleCompletionStatus(CompletionStatus& completionStatus, IntPtr overlappedAddress, IntPtr completionKey, Int32 bytesTransferred)
at AsyncIO.Windows.CompletionPort.GetMultipleQueuedCompletionStatus(Int32 timeout, CompletionStatus[] completionStatuses, Int32& removed)
at NetMQ.Core.Utils.Proactor.Loop()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I can't really include my code, but it seems like there is a possible bug in AsyncIO library?
Martin
The text was updated successfully, but these errors were encountered: