PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.95k stars 904 forks source link

Many connection with bots to write stresstest software #825

Closed fhebuterne closed 4 years ago

fhebuterne commented 5 years ago

Versions

Detailed description of a question

Hello,

I want to write little software to stresstest my minecraft server, but i have an issue when i connect 10 bots, it's ok no problem but when i want to connect 60 bots, i have timeout issue with bots with this error :

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: write ECONNABORTED
    at afterWriteDispatched (internal/stream_base_commons.js:78:25)
    at writeGeneric (internal/stream_base_commons.js:73:3)
    at Socket._writeGeneric (net.js:713:5)
    at Socket._write (net.js:725:8)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at Socket.Writable.write (_stream_writable.js:294:11)
    at Framer.ondata (C:\Users\Fabien\Desktop\botMinecraft\node_modules\readable
-stream\lib\_stream_readable.js:662:20)
    at Framer.emit (events.js:182:13)
    at addChunk (C:\Users\Fabien\Desktop\botMinecraft\node_modules\readable-stre
am\lib\_stream_readable.js:297:12)
Emitted 'error' event at:
    at Client.self._client.on (C:\Users\Fabien\Desktop\botMinecraft\mineflayer-1
.13\index.js:92:12)
    at Client.emit (events.js:182:13)
    at Socket.onFatalError (C:\Users\Fabien\Desktop\botMinecraft\node_modules\mi
necraft-protocol\src\client.js:139:12)
    at Socket.emit (events.js:187:15)
    at onwriteError (_stream_writable.js:425:12)
    at onwrite (_stream_writable.js:456:5)
    at _destroy (internal/streams/destroy.js:40:7)
    at Socket._destroy (net.js:613:3)
    at Socket.destroy (internal/streams/destroy.js:32:8)
    at afterWriteDispatched (internal/stream_base_commons.js:78:17)

Could you help me please ?

Sincerely, Fabien

rom1504 commented 5 years ago

Did you increase the timeout, what code are you using?

On Mon, Jun 10, 2019, 13:51 Fabien notifications@github.com wrote:

Versions

  • mineflayer: 2.7.3 ( git branch 1.13 )
  • server: paper spigot git-Paper-629 (MC: 1.13.2)
  • node: 10.13.0

Detailed description of a question

Hello,

I want to write little software to stresstest my minecraft server, but i have an issue when i connect 10 bots, it's ok no problem but when i want to connect 60 bots, i have timeout issue with bots with this error :

events.js:167 throw er; // Unhandled 'error' event ^

Error: write ECONNABORTED at afterWriteDispatched (internal/stream_base_commons.js:78:25) at writeGeneric (internal/stream_base_commons.js:73:3) at Socket._writeGeneric (net.js:713:5) at Socket._write (net.js:725:8) at doWrite (_stream_writable.js:410:12) at writeOrBuffer (_stream_writable.js:394:5) at Socket.Writable.write (_stream_writable.js:294:11) at Framer.ondata (C:\Users\Fabien\Desktop\botMinecraft\node_modules\readable -stream\lib_stream_readable.js:662:20) at Framer.emit (events.js:182:13) at addChunk (C:\Users\Fabien\Desktop\botMinecraft\node_modules\readable-stre am\lib_stream_readable.js:297:12) Emitted 'error' event at: at Client.self._client.on (C:\Users\Fabien\Desktop\botMinecraft\mineflayer-1 .13\index.js:92:12) at Client.emit (events.js:182:13) at Socket.onFatalError (C:\Users\Fabien\Desktop\botMinecraft\node_modules\mi necraft-protocol\src\client.js:139:12) at Socket.emit (events.js:187:15) at onwriteError (_stream_writable.js:425:12) at onwrite (_stream_writable.js:456:5) at _destroy (internal/streams/destroy.js:40:7) at Socket._destroy (net.js:613:3) at Socket.destroy (internal/streams/destroy.js:32:8) at afterWriteDispatched (internal/stream_base_commons.js:78:17)

Could you help me please ?

Sincerely, Fabien

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/825?email_source=notifications&email_token=AAR437VXDK66DMU2QXPURUTPZY54TA5CNFSM4HWS2PK2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GYRQQ3Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR437VNJHKKTCZBTWEQMQTPZY54TANCNFSM4HWS2PKQ .

fhebuterne commented 5 years ago

yes, but i have the same error, i'm using multiples example from mineflayer

const mineflayer = require('./mineflayer-1.13')

let i = 0
function next () {
  if (i < 100) {
    i++
    setTimeout(() => {
      createBot(`fabien-bot${i}`)
      next()
    }, 5000)
  }
}
next()

function createBot (name) {
  mineflayer.createBot({
    host: "localhost",
    port: 25202,
    username: name
  })
}
plexigras commented 5 years ago

you might also want to disable all the plugins you don't need or go with nmp.

https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#mineflayercreatebotoptions

https://gitter.im/PrismarineJS/node-minecraft-protocol

rom1504 commented 5 years ago

For a stress test mineflayer makes more sense actually, a nmp client will use less resources for the server (no physics / position sending)

On Mon, Jun 10, 2019, 18:16 plexigras notifications@github.com wrote:

you might also want to disable all the plugins you don't need or go with nmp.

https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#mineflayercreatebotoptions

https://gitter.im/PrismarineJS/node-minecraft-protocol

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/825?email_source=notifications&email_token=AAR437RSI46C2C376AL2KBTPZZ45ZA5CNFSM4HWS2PK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXKLIJQ#issuecomment-500479014, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR437RRHVAS6IVKURMQRJDPZZ45ZANCNFSM4HWS2PKQ .

rom1504 commented 5 years ago

Ok, can you try to increase the timeout ? I'm talking about the parameters you can pass to createBot

On Mon, Jun 10, 2019, 19:03 Romain Beaumont romain.rom1@gmail.com wrote:

For a stress test mineflayer makes more sense actually, a nmp client will use less resources for the server (no physics / position sending)

On Mon, Jun 10, 2019, 18:16 plexigras notifications@github.com wrote:

you might also want to disable all the plugins you don't need or go with nmp.

https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#mineflayercreatebotoptions

https://gitter.im/PrismarineJS/node-minecraft-protocol

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/825?email_source=notifications&email_token=AAR437RSI46C2C376AL2KBTPZZ45ZA5CNFSM4HWS2PK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXKLIJQ#issuecomment-500479014, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR437RRHVAS6IVKURMQRJDPZZ45ZANCNFSM4HWS2PKQ .

fhebuterne commented 5 years ago

Ok, can you try to increase the timeout ? I'm talking about the parameters you can pass to createBot On Mon, Jun 10, 2019, 19:03 Romain Beaumont @.> wrote: For a stress test mineflayer makes more sense actually, a nmp client will use less resources for the server (no physics / position sending) On Mon, Jun 10, 2019, 18:16 plexigras @.> wrote: > you might also want to disable all the plugins you don't need or go with > nmp. > > > https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#mineflayercreatebotoptions > > https://gitter.im/PrismarineJS/node-minecraft-protocol > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <#825?email_source=notifications&email_token=AAR437RSI46C2C376AL2KBTPZZ45ZA5CNFSM4HWS2PK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXKLIJQ#issuecomment-500479014>, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AAR437RRHVAS6IVKURMQRJDPZZ45ZANCNFSM4HWS2PKQ > . >

Hello, Sorry for the waiting time I've already try to increase checkTimeoutInterval but the issue is still here

Important : In 1.8.8 it's work perfectly

rom1504 commented 5 years ago

Ok, is your cpu at 100% for the process ? If so, spawn multiple process

rom1504 commented 5 years ago

1.9 and after are more cpu intensive to parse chunks. You can try to delay the connection of the bot so they have time to finish parsing chunks without overloading the cpu

rom1504 commented 4 years ago

Looks like it's solved