Closed WallyOxen closed 5 years ago
Also I'm using Gamedig version 2.0.12 and node version 10.2.0
The max port you can possibly use is 65535 so you need to add either a try/catch or validate that you are using a valid port before sending the query.
To be fair though, you should put it in a try/catch as well just incase it throws any more errors, then handle them accordingly.
I'm not having it query port 109357. It seems like that's the default it's trying as if I hadn't given it a port?
Hey there! The port 109357 part is actually expected (gamedig attempts to add the atlas query port offset of 51800). Obviously, the query to port 109357 will fail, but it should then retry with the port you provided, 57557.
Can you try version 2.0.13? The problem probably isn't fixed, but I've improved debug logging on requests involving multiple attempts, which should give us more of a clue about what's going on here.
Apologies for taking a while to respond. Also, thanks for looking into it. It does still throw the error. Here is the full console with debugging:
Q#0 Query is running with options: {socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, port: 109357, protocol: "valve", …}
Q#0 DNS Lookup: 46.251.238.70
Q#0 Raw IP Address: 46.251.238.70
Q#0 Requesting info ...
Q#0 Query failed with error Error: Invalid tcp/ip port: 109357
at Valve.assertValidPort (node_modules\gamedig\protocols\core.js:179:19)
at Valve.udpSend node_modules\gamedig\protocols\core.js:277:14)
at Valve.sendPacketRaw (node_modules\gamedig\protocols\valve.js:319:27)
at Valve.sendPacket (node_modules\gamedig\protocols\valve.js:253:41)
at Valve.queryInfo (node_modules\gamedig\protocols\valve.js:39:30)
at Valve.run (node_modules\gamedig\protocols\valve.js:30:20)
at Valve.runOnce (node_modules\gamedig\protocols\core.js:88:20)
Q#1 Query is running with options: {socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, port: 57557, protocol: "valve", …}address: "46.251.238.70"attemptTimeout: 10000debug: truehost: "46.251.238.70"maxAttempts: 1port: 57557protocol: "valve"socketTimeout: 2000type: "atlas"__proto__: Object
Q#1 DNS Lookup: 46.251.238.70Q
#1 Raw IP Address: 46.251.238.70
#1 Requesting info ...
Q#1 46.251.238.70:57557 UDP-->
Q#1 Buffer length: 25 bytes
ff ff ff ff 54 53 6f 75 72 63 65 20 45 6e 67 69 6e 65 20 51 75
T S o u r c e E n g i n e Q u
65 72 79 00
e r y
46.251.238.70:57557 <--UDP
Buffer length: 208 bytes
// EDIT: Removed raw buffer text
Q#1 Registered RTT: 162ms
Q#1 Received full packet
Q#1 Received 49 expected 49
Q#1 UDP send finished by callback
Q#1 STEAM APPID: 0
Q#1 PROTOCOL: 17
Q#1 Requesting player list ...
Q#1 46.251.238.70:57557 UDP-->
Q#1 Buffer length: 9 bytes
ff ff ff ff 55 ff ff ff ff
U
46.251.238.70:57557 <--UDP
Buffer length: 9 bytes
ff ff ff ff 41 a2 02 7c 01
A |
Q#1 Registered RTT: 140ms
Q#1 Received full packet
Q#1 Received 41 expected 44
Q#1 Received new challenge key: 24904354
Q#1 Challenge key changed -- allowing query retry if needed
Q#1 UDP send finished by callback
Q#1 46.251.238.70:57557 UDP-->
Q#1 Buffer length: 9 bytes
ff ff ff ff 55 a2 02 7c 01
U |
46.251.238.70:57557 <--UDP
Buffer length: 392 bytes
// EDIT: Removed raw buffer text
Q#1 Registered RTT: 144ms
Q#1 Received full packet
Q#1 Received 44 expected 44
Q#1 UDP send finished by callback
Q#1 Found player: Andy Grenade 0 13295.080078125
Q#1 Found player: Näätä 0 10830.5576171875
Q#1 Found player: Jobye Kayas 0 10716.2197265625
Q#1 Found player: 123 0 10460.7919921875
Q#1 Found player: 123 0 9056.8046875
Q#1 Found player: ericzanne 0 8569.40625
Q#1 Found player: david07407 0 7703.7060546875
Q#1 Found player: ふうせん 0 3522.25439453125
Q#1 Found player: *_( @rti ~ )_* 0 2725.43359375
Q#1 Found player: Ajin 0 2375.394287109375
Q#1 Found player: Olaf Bee 0 2225.732666015625
Q#1 Found player: xXSchuKenoXx 0 2153.36328125
Q#1 Found player: 123 0 1264.33837890625
Q#1 Found player: in memory 0 1017.4708862304688
Q#1 Found player: Cannello 0 543.63134765625
Q#1 Found player: Mysto 0 543.1273803710938
Q#1 Found player: EaSy 0 543.0089111328125
Q#1 Found player: Alvyan 0 543.0087890625
Q#1 Found player: Kasual 0 275.230712890625
Q#1 Found player: SilentControl 0 182.454345703125
Q#1 Found player: Dildosaurus 0 168.76222229003906
Q#1 Requesting rules ...
Q#1 46.251.238.70:57557 UDP-->
Q#1 Buffer length: 9 bytes
ff ff ff ff 56 a2 02 7c 01
V |
46.251.238.70:57557 <--UDP
Buffer length: 695 bytes
// EDIT: Removed raw buffer text
Q#1 Registered RTT: 135ms
Q#1 Received full packet
Q#1 Received 45 expected 45
Q#1 UDP send finished by callback
Q#1 Size of players array: 21
Q#1 Size of bots array: 0
Q#1 Query was successful
Q#2 Query is running with options: {socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, port: 109357, protocol: "valve", …}
Q#2 DNS Lookup: 46.251.238.70
Q#2 Raw IP Address: 46.251.238.70
Q#2 Requesting info ...
Uncaught (in promise) Error: Invalid tcp/ip port: 109357
at Valve.assertValidPort (node_modules\gamedig\protocols\core.js:179)
at Valve.udpSend (node_modules\gamedig\protocols\core.js:277)
at Valve.sendPacketRaw (node_modules\gamedig\protocols\valve.js:319)
at Valve.sendPacket (node_modules\gamedig\protocols\valve.js:253)
at Valve.queryInfo (node_modules\gamedig\protocols\valve.js:39)
at Valve.run (node_modules\gamedig\protocols\valve.js:30)
at Valve.runOnce (node_modules\gamedig\protocols\core.js:88)
Q#2 Query failed with error Error: Invalid tcp/ip port: 109357
at Valve.assertValidPort (node_modules\gamedig\protocols\core.js:179:19)
at Valve.udpSend (node_modules\gamedig\protocols\core.js:277:14)
at Valve.sendPacketRaw (node_modules\gamedig\protocols\valve.js:319:27)
at Valve.sendPacket (node_modules\gamedig\protocols\valve.js:253:41)
at Valve.queryInfo (node_modules\gamedig\protocols\valve.js:39:30)
at Valve.run node_modules\gamedig\protocols\valve.js:30:20)
at Valve.runOnce (node_modules\gamedig\protocols\core.js:88:20)
Q#3 Query is running with options: {socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, port: 57557, protocol: "valve", …}
Q#3 DNS Lookup: 46.251.238.70
Q#3 Raw IP Address: 46.251.238.70
Q#3 Requesting info ...
Q#3 46.251.238.70:57557 UDP-->
Q#3 Buffer length: 25 bytes
ff ff ff ff 54 53 6f 75 72 63 65 20 45 6e 67 69 6e 65 20 51 75
T S o u r c e E n g i n e Q u
65 72 79 00
e r y
46.251.238.70:57557 <--UDP
Buffer length: 208 bytes
// EDIT: Removed raw buffer text
Q#3 Registered RTT: 172ms
Q#3 Received full packet
Q#3 Received 49 expected 49
Q#3 UDP send finished by callback
Q#3 STEAM APPID: 0
Q#3 PROTOCOL: 17
Q#3 Requesting player list ...
Q#3 46.251.238.70:57557 UDP-->
Q#3 Buffer length: 9 bytes
ff ff ff ff 55 ff ff ff ff
U
46.251.238.70:57557 <--UDP
Buffer length: 9 bytes
ff ff ff ff 41 a2 02 7c 01
A |
Q#3 Registered RTT: 142ms
Q#3 Received full packet
Q#3 Received 41 expected 44
Q#3 Received new challenge key: 24904354
Q#3 Challenge key changed -- allowing query retry if needed
Q#3 UDP send finished by callback
Q#3 46.251.238.70:57557 UDP-->
Q#3 Buffer length: 9 bytes
ff ff ff ff 55 a2 02 7c 01
U |
46.251.238.70:57557 <--UDP
Buffer length: 392 bytes
// EDIT: Removed raw buffer text
Q#3 Registered RTT: 146ms
Q#3 Received full packet
Q#3 Received 44 expected 44
Q#3 UDP send finished by callback
Q#3 Found player: Andy Grenade 0 13310.7060546875
Q#3 Found player: Näätä 0 10846.1845703125
Q#3 Found player: Jobye Kayas 0 10731.845703125
Q#3 Found player: 123 0 10476.41796875
Q#3 Found player: 123 0 9072.4306640625
Q#3 Found player: ericzanne 0 8585.0322265625
Q#3 Found player: david07407 0 7719.33251953125
Q#3 Found player: ふうせん 0 3537.880615234375
Q#3 Found player: *_( @rti ~ )_* 0 2741.059814453125
Q#3 Found player: Ajin 0 2391.0205078125
Q#3 Found player: Olaf Bee 0 2241.35888671875
Q#3 Found player: xXSchuKenoXx 0 2168.989501953125
Q#3 Found player: 123 0 1279.964599609375
Q#3 Found player: in memory 0 1033.09716796875
Q#3 Found player: Cannello 0 559.2576293945312
Q#3 Found player: Mysto 0 558.7536010742188
Q#3 Found player: EaSy 0 558.6351318359375
Q#3 Found player: Alvyan 0 558.635009765625
Q#3 Found player: Kasual 0 290.85693359375
Q#3 Found player: SilentControl 0 198.08058166503906
Q#3 Found player: Dildosaurus 0 184.38845825195312
Q#3 Requesting rules ...
Q#3 46.251.238.70:57557 UDP-->
Q#3 Buffer length: 9 bytes
ff ff ff ff 56 a2 02 7c 01
V |
46.251.238.70:57557 <--UDP
Buffer length: 695 bytes
// EDIT: Removed raw buffer text
Q#3 Registered RTT: 186ms
Q#3 Received full packet
Q#3 Received 45 expected 45
Q#3 UDP send finished by callback
Q#3 Size of players array: 21
Q#3 Size of bots array: 0
Q#3 Query was successful
Wild thought, is it possible you are polyfilling node's Promise implementation with Bluebird or something else? Something like global.Promise = ***
?
This seems related to the bluebird bug: https://github.com/petkaantonov/bluebird/issues/1404 (as gamedig is certainly handling the exception that is being printed in your log as "uncaught").
I'll be honest, I have no idea what I'm doing apart from throwing things at a wall and seeing what sticks. (https://xkcd.com/1988/). From the little I know / understand about polyfilling the best response I can give you about this is my project has babel installed. I don't know if that's relevant or not but from what you've said and I've seen in the errors from debugging it seems to be my own issue that I'll have to figure out elsewhere. Thanks for the help and not being a jerk about a noob trying to learn 😄
Hmm, that may also do it. I haven't used babel with node.js recently, but I know in the past they had their own polyfill for Promise as well. Perhaps you could try not using babel if you aren't using any language features that it provides (node 10 has a lot of them built in!)
Please let me know if you find the issue, because if I can reproduce it locally, it's probably still something we should fix (or at least warn about) in gamedig.
Hello, I just want to start by thanking you for this. I've used it quite a bit on a few personal projects and it usually works without issue (or at least I'm the issue.) However I'm stumped on this one. I query an atlas server with
The first time I call it I get a full response, no issues. However when I put it inside a setInterval or setTimeout the following requests result in "Uncaught (in promise) Error: Invalid tcp/ip port: 109357". The server still returns all the info I'm just confused as to why when I provide a port the debug shows that its making a request at that port and then a second request at the port I specified?
The first attempt:
The second attempt (The one fired by setInterval / setTimeout):