Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[BUG] [API] events.js:72 Error: listen EADDRINUSE Possible double script execution

1438798785
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
I see that there is at least one other person that is occasionally getting the same error message right now  [See TokenLock thread].  And I see that HoneyBadger 4 months ago when he got this exact same error said it was double script execution. Anyway, I am getting an error and thought I would post my symptoms in the hope that it will help to track down what is happening.  Things are fine so long as I am actively using my campaign. It only seems to be when I first enter the system that the error ever occurs.  I have less than 200 lines of .js code. It is all to process api chat messages. It is an Earthdawn dice roller, where a step number is passed to it, and it calculates what dice to roll and rolls them. For example a step 8 would be 2d6!, and a step 10 would be 2d8! I can post the code if you like, but from what I read, the problem is possibly not in my code but is a system bug of some sort. Anyway, let me know if you want the code.  This has happened about 4 times in the last few days. At least once on the Dev server, and at least twice on the main server. It seems to me like the problem only occurs when the VTT is first opened. A few hours ago I exited the dev server VTT, And I think everything was OK at the time.. Just now I went to the campaign script page without opening the VTT, and the following message was there. Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:904:11) at Server._listen2 (net.js:1023:19) at listen (net.js:1064:10) at Server.listen (net.js:1132:5) at Sandbox.start (/home/symbly/www/d20-api-server/sandcastle/lib/sandbox.js:35:15) at Object.<anonymous> (/home/symbly/www/d20-api-server/sandcastle/bin/sandcastle.js:11:9) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) Once again, the VTT was NOT open at the time, and I think everything was OK when I closed it. Another time (on the main server) I opened VTT without opening the API page, and the dice roller was not working, so I opened the API page and saw the error above. So like I said, it seems to appear whenever ether the VTT or the API editor are first opened.  The campaign is 939405 on the main server and 36368 on the dev server. I am running Chrome version 44 something, and Windows 10, but I think it might have happened the first time before I updated from windows 8.1. I do have fog of war turned on (I know that was a large part of the discussion in the TokenLock thread.) Anyway, it is not a big deal for me, I just have to test to see if the dice roller is working when I enter and if not go to the api page and resave it. But it sounds like it is more annoying for some people and I hope that my observations might help it be fixed.
1438807306

Edited 1438807565
Pat S.
Forum Champion
Sheet Author
I have the same error and it is with an different API script (emas script). events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:904:11) at Server._listen2 (net.js:1023:19) at listen (net.js:1064:10) at Server.listen (net.js:1132:5) at Sandbox.start (/home/symbly/www/d20-api-server/sandcastle/lib/sandbox.js:35:15) at Object.<anonymous> (/home/symbly/www/d20-api-server/sandcastle/bin/sandcastle.js:11:9) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) If I save the script (there is no other script), it restarts fine but if I close the tab, it kicks the error up. The interesting thing is that if I do not close the tab it does not error out even if I go to another website and come back later on. Once active in the tab it stays active as long as the tab is left open. I'm on a windows 7 laptop running current chrome.
1438851456
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
Pat S. said: If I save the script (there is no other script), it restarts fine but if I close the tab, it kicks the error up. The interesting thing is that if I do not close the tab it does not error out even if I go to another website and come back later on. Once active in the tab it stays active as long as the tab is left open. This sounds interesting, but I am not certain that I understand what you are saying. Have you found a way to repeat the problem on demand? And some actions that if I avoid them will avoid the problem? It happens if you close the tab when which page is up: The VTT or the API scripts page? Then if you save the script again, the api restarts, and the problem never occurs again as long as the tab that restarted the api is still open? Could you give a few more details, especially an example of how to make sure the problem happens (if you know how to), and a sequence that causes the problem to never happen? I am sorry if I am being dense, but I just can't seem to make the problem happen on demand, but it is happening several times a day apparently at random.
1438853560
Pat S.
Forum Champion
Sheet Author
Chris D. said: It happens if you close the tab when which page is up: The VTT or the API scripts page? Either. It did not matter which I had open when I closed the tab. Once the tab was closed then reopened (basically a new tab) the error was there. Chris D. said: Then if you save the script again, the api restarts, and the problem never occurs again as long as the tab that restarted the api is still open? Correct. If I saved the script, I got a new sandbox spin up which has the API script running. The problem never showed up after I went to various other sites in that tab then returned to it in the same tab. Chris D. said: Could you give a few more details, especially an example of how to make sure the problem happens (if you know how to), and a sequence that causes the problem to never happen? I am sorry if I am being dense, but I just can't seem to make the problem happen on demand, but it is happening several times a day apparently at random. The error would appear every time I closed down the browser tab to that campaign (no tab open to the room nor the api page) and open a new one to that campaign. I did it about 10 times in a row just trying out different things. I did it with my extensions on, did it with extensions disabled, did it with my Antivirus paused. It didn't matter. Once I closed the tab and reopened it, the error was there.
1438876272
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
Pat S. said: The error would appear every time I closed down the browser tab to that campaign (no tab open to the room nor the api page) and open a new one to that campaign. I did it about 10 times in a row just trying out different things. I did it with my extensions on, did it with extensions disabled, did it with my Antivirus paused. It didn't matter. Once I closed the tab and reopened it, the error was there. Hum, then I must have something different, because that does not happen for me. I just tried what you described a half dozen times, and nothing. In fact the problem has not happened to me at all today, but it happened twice yesterday.
1441897333
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
So does anybody know how this can be fixed? It is still doing this and is annoying. Every new when I enter the campaign the script is stopped and I have to restart it. Then it is fine until the next day (or I suppose until I close the browser, which I only do at the end of the day). It is easy enough to work around, but is there a way to stop this behaviour?
Once we are done with our Jukebox update, we are going to be updating the API engine next so hopefully that will fix a lot of the API issues people have. As for your specific issue, I'll see if I can get another dev to look into it and see if we have a possible fix.