smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.74k stars 2.77k forks source link

Nodejitsu not working #125

Closed coderarity closed 11 years ago

coderarity commented 11 years ago

Hi!

I'm from Nodejitsu and someone was trying to run this on Nodejitsu server, and apparently was having login problems, with people being logged in as guests (here's the URL http://play.pokemonshowdown.com/~~nuggetbridge.jit.su:80/lobby). I ssh'd into the drone with the app to make sure there were no error logs anywhere, and I noticed there were a few child processes. They don't seem to be using sockets to communicate, so I think that they should work. I'm not really sure what the issue could be, I couldn't find anything, so any ideas you might mention could help us to figure out what's up. In any case, if there's any information I can provide to help solve this problem, let me know here, or come into IRC at #nodejitsu on irc.freenode.net and we can try to solve it there. Thanks!

-- coderarity

Zarel commented 11 years ago

I joined your IRC channel. We didn't really figure anything out. Here's an IRC log, though:

[12:20] Does anyone know if 'coderarity' is here, or if he/she goes by a different nick on IRC? [12:21] he goes by coderarity [12:21] but he's not here at the moment :) [12:21] I can wait, otherwise if someone else wants to talk to me about it? [12:22] Well.. I'm not sure any of us can help you besides him, since he's the one that saw what was going on.. [12:22] Zarel: hi shift doesn't start for another 6 hours, one of us may be able to help [12:22] I've not heard anything about that issue before now. [12:23] well, it's interesting, because PS works fine on every server I've tested on. [12:23] Including Heroku, which seems quite similar to Nodejitsu [12:23] The precise problem here leads me to believe it's an issue with either the child_process or crypto modules [12:24] PS uses three processes. Most things go on in the main process, but battle simulation and crypto are their own processes. [12:25] The crypto process is probably mostly unnecessary - I made it a separate process on suspicion that it would improve lag issues, since the Node crypto functions are synchronous and I wanted to make them asynchronous. [12:25] Zarel: I'm not even sure what the error actually is that we're supposed to be looking at. [12:25] * FrenkyNet has quit (Quit: Computer has gone to sleep.) [12:26] There's in fact no "error". As far as I can tell, PS is given a token signed by a login server. It passes it to a validator process to validate the token... and receives no response. [12:26] Every other server I've tested it on, the validator process sends a response without issue. [12:27] It's a pretty simple file, too, if you'd like to take a look: [12:27] https://github.com/Zarel/Pokemon-Showdown/blob/master/verifier.js [12:28] Well.. I mean.. [12:28] I was able to load the page that he posted fine.. [12:29] Sly, click "Choose name" in the top right, and enter a name [12:29] You won't be able to use that name [12:29] I did. [12:29] Tells me that it's registered. [12:29] Choose a name unlikely to be registered - just mash the keyboard [12:29] Compare it to a working server: [12:29] http://play.pokemonshowdown.com/~~dev/lobby [12:31] Well.. when I try to choose a name.. [12:31] I see the request go out, and I get a 200 response from action.php with the name I entered in it. [12:31] So it looks like it's returning for me? [12:31] Yeah, it's returning for both servers [12:32] Here's what's going on [12:32] when you choose a name, the client requests action.php for whether or not it's registered [12:32] if it's registered -> it asks you to log in [12:32] if it's unregistered -> you get a signed token saying that the name is unregistered and you're free to use it [12:33] the token gets passed to the PS Node server, and the Node server verifies that the token is correctly signed, and it gives you that username [12:33] On a normal server, everything works fine, you get that username [12:34] In Nodejitsu, my guess is that the verifier never gives a response [12:34] This is all speculation, of course, I don't have enough access to Nodejitsu to be sure of anything [12:38] I honestly have no clue. [12:39] What's the username/app name that you're using? [12:39] Sly, if you littered verifier.js with console.log()s, you could probably see what does and doesn't work [12:39] What do you mean by username/app name? [12:40] Aren't you hosting a server on Nodejitsu? [12:40] No. [12:40] Ah. So that's someone else's, just your app? [12:40] Yeah. [12:40] I'm just responding to a bug report asking me to join here and help out [12:40] Okay. I've got'cha. [12:40] I thought it was your app. That's why I was getting confused on how you didn't know what was happening. xD [12:41] Zarel: do any of the processes that you spawn with child_process open ports? [12:41] Sly, no, only the main one [12:41] Hm. [12:42] the other processes don't do any IO besides communicating with the main process [12:42] and in rare cases writing to console.error()

coderarity commented 11 years ago

"if you littered verifier.js with console.log()s, you could probably see what does and doesn't work"

I will do just that. :D

Zarel commented 11 years ago

Ping. Any progress on this, @coderarity?

The bug seems to have to do with multi-process support.

This bug might also be related to the bugs we experienced in Node 0.10.0 and 0.10.1, so upgrading to 0.10.2 or higher might fix it.

Zarel commented 11 years ago

Closing this was a misclick; sorry. :/

Zarel commented 11 years ago

I'm closing this because of a lack of response in three weeks, and a lack of any activity in five months. This issue was most likely the issue we fixed by upgrading to Node 0.10.2, so my guess is that it should be fine now. If it's still present, feel free to reopen this.

coderarity commented 11 years ago

Sounds good, I won't be getting to this, I don't work for Nodejitsu anymore.