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

When I try to spawn more than 30 bots on party #47

Closed
DaAwesomeRazor opened this issue Jan 7, 2016 · 16 comments
Closed

When I try to spawn more than 30 bots on party #47

DaAwesomeRazor opened this issue Jan 7, 2016 · 16 comments

Comments

@DaAwesomeRazor
Copy link

DaAwesomeRazor commented Jan 7, 2016

buffer.js:788
throw RangeError('Trying to write outside buffer length');
^
RangeError: Trying to write outside buffer length
at RangeError ()
at checkInt (buffer.js:788:11)
at Buffer.writeUInt8 (buffer.js:794:5)
at Object.Client.onConnect (/opt//bots/agario-client.js:93:17)
at .onOpen (/opt//node_modules/ws/lib/WebSocket.js:432:14)
at .EventEmitter.emit (events.js:92:17)
at .establishConnection (/opt//node_modules/ws/lib/WebSocket.js:862:8)
at ClientRequest.upgrade (/opt//node_modules/ws/lib/WebSocket.js:753:25)
at ClientRequest.g (events.js:180:16)
at ClientRequest.EventEmitter.emit (events.js:106:17)
at socketOnData (http.js:1612:11)

Is it because I updated ws?

@pulviscriptor
Copy link
Owner

"Trying to write outside buffer length"? This is something new.
By looking at your agario-client.js location in bots/agario-client.js is wrong. It must be in node_modules folder so i assume you modified original code of lib. This is very wrong.
Open your agario-client.js and show me onConnect: function() { ... block.
Mine looks like this http://pastebin.com/raw/EHPBjtEa
Your should be exact same. If your are modified, you using lib wrong way.
But just to be sure, show me that block of code.

@DeepSnowNeeL
Copy link

Hi, I'm running agarbot.ovh. We used a modified version of your code for
our first version back in november. When we had around 250 bots, packets
starts to "de-sync", so you might encounter a lot of buffer overflow /
buffer underflow / incorrect packet id because of the datastream index
shifting/skiping few bytes.
We fixed it by re-developping everything in java. But it is mainly because
of the way node.js and your OS / network communicate. I don't think you
can't find another solution than ignore errors (try catch them and let it
go). Bots can still run if they miss some update (packet 16), but you might
not detect the bot death so take care. I would personally disconnect the
bot and reconnect a new one on error.
If needed I can check our old logs, I would be able to give a few more
examples with stacktraces.

Have fun !

Le ven. 8 janv. 2016 à 06:55, pulviscriptor notifications@github.com a
écrit :

"Trying to write outside buffer length"? This is something new.
By looking at your agario-client.js location in bots/agario-client.js is
wrong. It must be in node_modules folder so i assume you modified
original code of lib. This is very wrong.
Open your agario-client.js and show me onConnect: function() { ... block.
Mine looks like this http://pastebin.com/raw/EHPBjtEa
Your should be exact same. If your are modified, you using lib wrong way.
But just to be sure, show me that block of code.


Reply to this email directly or view it on GitHub
#47 (comment)
.

@pulviscriptor
Copy link
Owner

@DeepSnowNeeL This is what i did in issue 46 #46
There is now client.on.packetError event.
But this issue is related to sending packets. I'm almost sure that @DaAwesomeRazor broke his client by modifying something in onConnect block. Original block looks like this http://pastebin.com/raw/EHPBjtEa and there should not be any errors.

@DaAwesomeRazor
Copy link
Author

I just edited a few things in agarioclient.js so I ccan get more than 5 bots. Socks5 wasnt working

@DaAwesomeRazor
Copy link
Author

Oh I did modify the Connect though. I added localAddress

@pulviscriptor
Copy link
Owner

@DaAwesomeRazor is there bug in client's code, or you solved the problem?

@davidmann4
Copy link

@DaAwesomeRazor what exactly did you changed?

@DaAwesomeRazor
Copy link
Author

I havent solved the problem but, im trying to fix it right now

@henopied
Copy link
Contributor

Can confirm, no modifications to the agar client. Might using smartbuffers help?

@pulviscriptor
Copy link
Owner

@henopied
You can confirm the crash?
@DaAwesomeRazor
Show me your onConnect: function() { ... block please.

@davidmann4
Copy link

@DaAwesomeRazor
I guess the 5 connections limit is a server side limitation...

@DaAwesomeRazor
Copy link
Author

@pulviscriptor
connect: function(server, key, localAddress) {
var headers = {
'Origin': 'http://agar.io'
};

    this.ws            = new WebSocket(server, null, {headers: headers, agent: this.agent, localAddress: localAddress});
    this.ws.binaryType = "arraybuffer";
    this.ws.onopen     = this.onConnect.bind(this);
    this.ws.onmessage  = this.onMessage.bind(this);
    this.ws.onclose    = this.onDisconnect.bind(this);
    this.ws.onerror    = this.onError.bind(this);
    this.server        = server;
    this.key           = key;

    if(this.debug >= 1) {
        if(!key) this.log('[warning] You did not specified "key" for Client.connect(server, key)\n' +
            '          If server will not accept you, this may be the problem');
        this.log('connecting...');
    }

    this.emit('connecting');
},

@pulviscriptor
Copy link
Owner

@DaAwesomeRazor
Copy link
Author

@pulviscriptor I dont think I changed that

@pulviscriptor
Copy link
Owner

@DaAwesomeRazor
Do you still have crash Trying to write outside buffer length in onConnect? And how often you see it?
And if you do have it, show me onConnect block please.

@DaAwesomeRazor
Copy link
Author

@pulviscriptor I got it to work! I just recoded my client and updated the Agario Client it wasnt up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants