Skip to content
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

Gamelogs don't generate on Mac OS X #2

Closed
JacobFischer opened this issue Oct 2, 2015 · 4 comments
Closed

Gamelogs don't generate on Mac OS X #2

JacobFischer opened this issue Oct 2, 2015 · 4 comments
Assignees
Labels

Comments

@JacobFischer
Copy link
Member

Apparently on Mac OS X gamelog files are not generated. Logs are using the --log arg, but even though no errors claim to happen no files are dumped in output/gamelogs according to @takaaptech in siggame/Joueur.lua#2. Basically run two lua clients against each other playing checkers. We expect a gamelog to be generated. Instead none get output.

As I don't have access to this OS, could someone with an Apple machine check this out? takaaptech theorized that maybe the game session thread process was not properly sending data back to the main thread.

I'm more than willing to sit down with any devs to sort this out.

@takaaptech
Copy link

If i change code from session.js:
process.send({
gamelog: this.generateGamelog(),
});
to:
process.send({
gamelog: 'some data',
});

Then gameSession.worker.on("message", function(data) in lobby.js fired.
In current code, gameSession.worker.on("message", function(data) never fired. gameSession.worker.on("online", function() fired one.

Maybe that will help you find something. I still can not fix this bug.

@JacobFischer
Copy link
Member Author

Thanks, that helps.

So after reading about some of the changes from NodeJS 0.12.X to 4.0.0 (which was a large overhaul), they changed process.send (for the better), but I think that broke it working on Macs.

Can you try this version of session.js: http://pastebin.com/s57CvJu9

Basically I attached a callback to process.send (a new feature in 4.0), and the thread won't exit until it gets confirmation the gamelog was sent.

My guess is that because process.send is asynchronous, on Windows/Linux the process can send the gamelog back before clients disconnect and the thread ends, but on mac the clients disconnect first so the gamelog never actually gets sent.

If that works I'll push this fix. I feel pretty confident we've figured out what's going on here. So I'm hopeful!

@takaaptech
Copy link

Wow!
Lobby @ 617 Found game 'Checkers'.
Lobby @ 617 --- Webserver running on localhost:3080 ---
Lobby @ 617 --- Lobby listening on localhost:3000 ---
Lobby @ 617 Received new connection!
Lobby @ 617 Received new connection!
Checkers - 1 @ 620 Received new connection!
Checkers - 1 @ 620 Received new connection!
Checkers - 1 @ 620 Game is starting.
Checkers - 1 @ 620 Game is over.
Checkers - 1 @ 620 Client Checkers Lua Player disconnected
Checkers - 1 @ 620 Client Checkers Lua Player disconnected
Checkers - 1 @ 620 HEY I SENT THE GAMELOG
Lobby @ 617 Game Session @ 620 exited

screen shot 2015-10-03 at 8 42 07 pm

You fixed it!

@JacobFischer
Copy link
Member Author

Perfect! Odd the difference in sequence of events between operating systems, but that's the pain with asynchronous multi-threaded code. I'll push the code then. Thanks for all your help!

@JacobFischer JacobFischer self-assigned this Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants