jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

SESE causes economy to cause an exception during auto restart #134

Closed midspace closed 8 years ago

midspace commented 8 years ago
TheNudeNerd :
There is an error between SE Server extender and this mod. This error happens when using the automated restart from SE Server Extender Essential plugin. When the server restarts, this error causes SE Server Extender to hard crash.

The specific error from the console is:
Unhandled Exception: System.ObjectDisposedException: Cannot access a closed file.
at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at Economy.scripts.TextLogger.Finalize()

This is a might unusual, as we don't explicitly close the TextLogger stream except during the Finalize() ~TextLogger() or when the Mod calls UnloadData.

There must be 2 simultaneous calls hitting the TextLogger, one from the MySessionComponentBase.UnloadData() and the other during disposal Finalize().

We'll have to look at using FastResourceLock(...), or more exception handling.

midspace commented 8 years ago

SESE details:

Latest release https://github.com/SEServerExtender/SEServerExtender/releases/latest

Documentation (is crap, because it's just been started): http://seserverextender.com/

Current thread (I think): http://forums.keenswh.com/threads/se-server-extender-current-releases-and-plugins.7333303/

jpcsupplies commented 8 years ago

I think I removed the two places I tried to use text logger before merging to master so hopefully i didnt put anything silly in anywhere. As i recall sese disables the DS save map option entirely and handles the save itself.. from when I tried to use it last. Not sure how that would react to our mod tho.

jpcsupplies commented 8 years ago

Ok this is for TheNudeNerd - 1: can you paste/link to a log with the error (so we can see the timing/sequence of events) 2: midspace made a change we hope gets around the issue in our dev release here: http://steamcommunity.com/sharedfiles/filedetails/?id=515710178 Are you able to swap out our public version and try this one instead briefly to see if you get the same or another error, or no error on your sese server?

TheNudeNerd2 commented 8 years ago

I'm at work at the moment. When I get home tonight I will try to set up a copy of my server on my local machine for testing purposes. As far as the error log, unfortunately that is all I see - that specific error appears in the console / Windows cmd window that is open when running SESE. I've tried combing through some of the SE log files but don't see anything helpful. As far as testing your dev builds, I don't mind helping with that but I'm trying to build a little community on our server and downtime due to mods etc tends to run people off. Not saying I won't put it on our server if I can make sure it's fairly stable before builds go out... I just don't want huge downtimes on a live server, ya know?

TheNudeNerd2 commented 8 years ago

Grr.. ok I tried setting up a test copy on my local machine, but it's not reproducing this issue. I am going to go ahead and put the dev version you posted on my live server and will let you know how it works out.

TheNudeNerd2 commented 8 years ago

Also note that I am using the Essentials plugin for SESE - https://github.com/SEServerExtender/EssentialsPlugin/releases/

jpcsupplies commented 8 years ago

Yup that is fine, we use the dev Economy build on our own live server just for convenience. We have a 3 step release process: 1: Confirm local debug passes - Push to git. Tests ok for both of us. 2: All local tests ok, push to dev workshop test (used on our live server ) 3: Passes test on our live server and main feature is completed, tweak defaults, push to the public workshop release; announce release. Update user documentation.

You are just working with our pre-official-release instead of official release at stage 2. Which is the version we will release if it fixes the issue anyway.

If you don't get the same issue with the DEV version hopefully this means issue is resolved. ! Let us know anyway.

TheNudeNerd2 commented 8 years ago

It did not fix it. Same exception, with the following message above it. The HKRigidBody is repeated a bunch of times then followed with the exception.

HkRigidBody was not disposed, stack trace:

Unhandled Exception: System.ObjectDisposedException: Cannot access a closed file. at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at Economy.scripts.TextLogger.Finalize()

jpcsupplies commented 8 years ago

Ok i setup a fresh RDP sese+essentials based DS but I had all kinds of hell with SESE in general. Couldn't get any obvious clash with Economy happening; but did get a lot of other odd errors.

I've passed the logs over to midspace to look over.

midspace commented 8 years ago

The log files don't indicate any issues with the Economy mod.

This issue is primarily caused by the way SESE shuts down during a restart. Currently it forcefully kills the process, which is not a nice thing to do. I had a talk with the SESE team, and they will look at implementing more sane methods of shutting down the server.

For the moment, I think we can only put a try...catch in, to prevent weirdness from spreading.

jpcsupplies commented 8 years ago

@TheNudeNerd2 give the dev release a go now - if it is all good ill push it out to the public release so you can switch back to our stable version instead of our mad scientist testing version.

TheNudeNerd2 commented 8 years ago

It works! The server restarted without crashing SESE.

TheNudeNerd2 commented 8 years ago

Can you post or message me when this is pushed to public release, so I can get it added back into server? Thanks!

jpcsupplies commented 8 years ago

Ok it is in.