Extension auto-reload works inconsistently (rarely)

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

aaron
Posts: 2
Joined: 02 Mar 2021, 17:58

Extension auto-reload works inconsistently (rarely)

Postby aaron » 05 Mar 2021, 18:53

Hello,

I am making a Unity game and using an extension to write some server code for it, but it is painstakingly difficult because most of the time the extension fails to reload without me restarting the server.

Here are the details: I have one extension jar file, I export it to the required extension folder, I make a small change in the code (e.g. change output text) and re-upload the jar, but the old extension runs. The C# code simply connects to the server, logs in and sends/receives one extension request. The code is very similar to the "Connector" Unity example in the docs. The extension reload mode is set to auto and it is a zone extension. I am using Windows 10 and running the server on localhost. I have tried running SFS as a service and as a standalone. I have tried uploading the new extension while I am connected/logged in to the server and while I am disconnected. I have tried reloading the extension manually in the admin tool. I made sure the jar is in the correct folder and that it shows it is modified whenever I re-compile it. I have even done things like try to see if it works when I am logged in/out of the admin tool, or when having SFS folders open/closed on my local filesystem.

The strangest part of this is that: (1) every time I re-upload the jar, Smartfox recognizes the new extension by saying "reloading extension" immediately followed by "Destroy is called" (oddly enough, in that order), but by far the most weird is that (2) it SOMETIMES works. Yesterday, I successfully was able to update my extension without any restarts of the server, even while being logged in to the zone, but today I cannot replicate that setup.

Please believe me when I say that I have scoured your docs, this discussion board and other sources, but I cannot figure out what is wrong. This is a group project that I am taking for credit, and we're all in on SFS, so it would be really ideal if we can get this to work!

Thank you
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Extension auto-reload works inconsistently (rarely)

Postby Lapo » 06 Mar 2021, 11:47

Hi,
The strangest part of this is that: (1) every time I re-upload the jar, Smartfox recognizes the new extension by saying "reloading extension" immediately followed by "Destroy is called" (oddly enough, in that order), but by far the most weird is that (2) it SOMETIMES works. Yesterday, I successfully was able to update my extension without any restarts of the server, even while being logged in to the zone, but today I cannot replicate that setup.

The order of messages is perfectly normal. First the new extension is loaded and subsequently the old version (that is still running) is removed and the relative destroy() method is invoke before exiting.

One potential issue with uploading an extension remotely is that if the transfer is slow the server reload will be triggered before the upload is actually complete. For remote deployments we usually recommend to use the Manual Reload Mode, instead.
The only difference with this mode is that, once the upload is complete, you hit the "Reload Extension" from the AdminTool > ZoneMonitor.

This should fix the problem once and for all.
Let us know.
Lapo
--
gotoAndPlay()
...addicted to flash games
aaron
Posts: 2
Joined: 02 Mar 2021, 17:58

Re: Extension auto-reload works inconsistently (rarely)

Postby aaron » 07 Mar 2021, 03:28

Thank you for your quick response.

The order of messages is perfectly normal. First the new extension is loaded and subsequently the old version (that is still running) is removed and the relative destroy() method is invoke before exiting.

That makes sense, thanks for clarifying.

It so happens that the issue I am experiencing is happening both when I try running Smartfox on my localhost or on a remote server. Nevertheless I tried using manual reloading instead (on localhost) while logged in to my zone, to no avail.

Is there any other info I can give you / tips you can give me? I feel like I tried everything but I am missing something obvious perhaps. The oddest part is that it was working perfectly a few days ago but not anymore, and I really do not know what changed in my setup.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Extension auto-reload works inconsistently (rarely)

Postby Lapo » 08 Mar 2021, 11:43

Hi,
the fact that it doesn't work locally seems very strange.
Can you show me the server side logs of the Extension redeploy in the local server?
Also what's the size of the Extension jar?
And what version of SFS2X is this?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 60 guests