-
Notifications
You must be signed in to change notification settings - Fork 24
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
JS heap out of memory for the example task #133
Comments
You are not waiting for promises correctly. |
@extremeheat Could you elaborate more about how to do it? As it is the example code on README I am using. |
@extremeheat I've got a similar issue and I think I properly awaited it. After about 30 seconds node crashes. During this time its also entirely blocking and other events aren't firing. Here's a minimal example reproducing it: import mineflayer from "mineflayer"
import collectblock from "mineflayer-collectblock"
const bot = mineflayer.createBot({
host: "localhost",
port: 51870,
username: "test",
})
bot.once("spawn", () => {
bot.loadPlugin(collectblock.plugin)
setTimeout(async () => {
bot.chat("Doing some stuff now!")
const blocks = bot.findBlocks({
matching: 1, // stone
maxDistance: 32,
count: 2,
})
const targets = blocks.map((block) => bot.blockAt(block))
await bot.collectBlock.collect(targets, { ignoreNoPath: true })
bot.chat("done")
}, 1000)
})
bot.on("chat", (username, message) => {
console.log(`Chat> ${username}: ${message}`)
}) Some observations:
There is inconsistent behavior if the bot's inventory is empty vs. if it has a tool to mine the stone. Also, if you adjust the findBlocks count sufficiently high, sometimes it will mine a block or two, but not all of them. After about 30 seconds it crashes with a similar error:
|
Program exit with
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
when executing the sample task:
The console log:
The stone is right next to the agent, and agent is not mining.
The text was updated successfully, but these errors were encountered: