-
Notifications
You must be signed in to change notification settings - Fork 77
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
dotnet core 2.0 application aborts #60
Comments
@pavlexander, I had not considered anyone serializing So, my best guess is that there is a race condition between the static initialization of the Cache and the implicit operator using the Cache. Perhaps the implicit operator is occasionally hitting a null Cache. To potentially fix this, I will move the initialization of the Cache to the static constructor. If you want to test this theory (and confirm a workaround), you can try accessing |
I have changed the code to following (prepend cache retrieval before "start"):
The app would still Abort occasionally. But in this case - "Start" is not being printed. |
@pavlexander, at least that narrows it down further. There are the BCH Symbols defined in the static constructor that are referenced by the Cache. Perhaps the Cache is being initialized before the constructor completes. Moving the Cache initialization to the static constructor could still fix that. But, as a workaround, perhaps try something that doesn't access the Cache like |
Just a moment ago tested with:
Same error. I will try out some more cases and see if any of them not cause abortion.. |
Just substituted Symbol, with Asset in the code above and checked if the issue there is for Assets as well. I couldn't reproduce the issue. At least that one we can exclude. So the issue seems to be related with Symbol initialization only. To fix the issue I tried to dispose of static Symbol constructor in the source code - it didn't resolve the issue. |
retesting of this issue is a breeze now.
For anyone interested. The linux command will execute dotnet application once in half-a-second time. Therefore, if at least one "Aborted" is printed within 20 second interval - you can consider the test as not passed. |
Alright, To determine what's causing the issue - i started to strip down Symbol class apart, until there was almost nothing left. To say, I have got rid of:
Basically, what I am left with now (almost) are sections of Symbols for BTC, ETC and BNB, ..
When I say that the issue is gone _ I mean that I was rerunning the above code for atleast 2 minutes and there were no Abortions. I think it's a combination of all 4 sections is what's causing the issue. Could it be a dot net core limitation of some kind, for the number of static properties to be initialized in one class? Or something? Additionally, I have tried marking Symbol class as partial and moving 4 sections into 3 different partial classes (3 and 4 sections together), leaving methods inside the first, main, fourth partial class. This did not yield any good results as well. My discovery does not make this issue resolution any easier, @sonvister Hope that will be of some help. |
First of all, I am extremely sorry so spamming. I tend to post messages as I progress on the matter of this discussion. Secondly - the issue is now resolved :) Well, I am now not sure if there is such word as resolved now. I mean that after 5 minutes of task run - there are 0 abortions. Following last post thematics - I continued to strip down symbol initialization. I firstly disposed of that is when I first noticed that the issue was gone. After that I added 2 parameters back, and chnaged the signature to following (for all symbols):
I.e. instead of using anonymous type of object It seems like the core of the framework is having some issues when a whole bunch of anonymous objects are created. Would It be possible to apply above fix for you API, @sonvister ? As I recall there was some code which was generating Symbols dynamically. That's probably The place :) Cheers |
@pavlexander, no worries, someone might find the saga interesting. It is certainly a good example of debugging (zeroing-in on the root cause). I'll create 0.2.0-alpha31 with this (unexpected) change and move the initialization of properties/fields to the static constructor (seems like a good idea). But, first, would you confirm if |
@pavlexander, I've released 0.2.0-alpha31 with updates for this issue (I used |
@sonvister believe it or not, but Thank you for your library and support! |
@pavlexander, no problem. 0.2.0-alpha32 released with |
Thanks! |
@pavlexander, it may help to also move the initialization of all the readonly symbols to the static constructors as well in both Symbol and Asset. |
@pavlexander, if you are not feed-up with testing, I uploaded an alternative NuGet package with the GitHub 0.2.0-alpha32 release. I moved initialization of the symbols to the static constructor and reverted back to new [] { } (for testing) and pushed the code too. I will go back to |
@sonvister, no problem. |
@pavlexander, by latest, are you referring to the v32 from NuGet or the v32 alternative I posted on GitHub, or both? If you are referring to the former, then it is probably working because of the If you are referring to the later (or both), great, I'd say it has to do with the sequence of initialization and possible indeterminate timing of the initialization and by putting them all in the static constructor makes the initialization sequential. |
@sonvister I was referring to v32 from NuGet. For the github version - should I just download the latest code source or is there a hack in VS? |
You could get the source code and publish a .nuget package if you prefer or just download the already published .nuget package from GitHub. From there you switch to a local NuGet package source (a configured local folder) and install Binance from there. Since the versions are the same, you may need to remove first then install. |
if I understood correctly, the second approach is:
I have never done this before but it looks like a way to go. let me check. |
Well... I'll just upload 0.2.0-alpha33. |
I just followed the tutorial above. The result could have never been worse :) |
How about 0.2.0-alpha33? |
After upgrading to newer version in Nuget - I was getting:
Any good approaches on fixing that? My solution was to clean up Binance reference, removal of Bin + Obj folders, closing and reopening VS, and then re-adding of reference v33, and only then then issue was gone.. This is not the first time I see this message and it's annoying. As for tests - they still fail.. same 100% aborted results. |
I suspect that |
@sonvister the issue described in this ticket turned into something bigger. The fix is planned in 2.1.0 release of dotnetcore. After it is released - feel free to revert the data to the type of your wish. Thank you for keeping it as |
I used to have this issue that 40%+ of a time when I deserialized a JSON (which contained
Symbol
objects as keys in a dictionary) - my application would "abort". The issue was only reproducible on Linux environment and not on Windows.The issue was fixed by changing the
Symbol
data type to string and de-serializing "string" instead. This was easy solution, since string can be easily converted back to Symbol later on. However, when I tried to do so - the problem was back. With a bit of testing I was able to simplify the testing approach to reproduce the issue.Here is the code:
And here are the results:
If you look closely at the output - you will then notice that about 2/10 times there is an "Aborted" message. The "End" is never hit. No exceptions are thrown. Basically, sometimes when the object is converted from string to Symbol - .net core application crashes.
Linux is
"dotnet --version" command output is:
Compiled on Windows with command:
I would appreciate to hear out any advices on how to solve this issue? Or even to debug it. As You can see from the output - no actual exception is shown. The application just stops.
Also, it would be good if somebody else from the community could confirm this issue. Maybe it's just my machine issue.
Thanks.
The text was updated successfully, but these errors were encountered: