Error: malloc(): invalid size (unsorted)
Error on npm run generate command. Error occurs in Docker, no error in dev mode. The error occurs on MacBook m1 pro, everything works fine in Ubuntu. I ran it in Ubuntu virtual machine with MacBook m1 pro, it says that the memory limit is exceeded. I tried it this way, I delete all images from the project and everything works, that is, the error is exactly in this plugin.
MacBook: ` 29.71 ✔ Generated static image dist/_nuxt/image/f26acf.webp 29.72 ✔ Generated static image dist/_nuxt/image/7215df.webp 29.72 ✔ Generated static image dist/_nuxt/image/b27296.webp 29.72 ✔ Generated static image dist/_nuxt/image/96f0ac.webp 29.73 ✔ Generated static image dist/_nuxt/image/9435f4.png 29.73 malloc(): invalid size (unsorted) 29.79 Aborted
dockerfile:26
24 | 25 | ## Render HTML site 26 | >>> RUN npm run generate 27 | 28 | FROM nginx:1.21.1-alpine `
Would you be able to provide a reproduction? 🙏
More info
Why do I need to provide a reproduction?
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
What will happen?
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.
If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
How can I create a reproduction?
We have a template for starting with a minimal reproduction:
👉 https://stackblitz.com/github/nuxt/image/tree/main/example
A public GitHub repository is also perfect. 👌
Please ensure that the reproduction is as minimal as possible. See more details in our guide.
You might also find these other articles interesting and/or helpful:
Note that alpine sometimes has issues with memory allocation and gc. You might try debian or node:slim variants for build stage.
Would you be able to provide a reproduction? 🙏
More info
it will be difficult, the project is corporate
Note that
alpinesometimes has issues with memory allocation and gc. You might trydebianornode:slimvariants for build stage.
did not help
Would you be able to provide a reproduction? 🙏
More info
I thought it was just a docker error, but the problem turns out to be something else entirely. The error is specifically in one picture, if I remove it, the code works, if I use it, the code crashes immediately, but in Ubuntu 22.0.4 it works, but in MacOS Ventura the build crashes immediately. You need to uncomment https://github.com/AAA55555/nuxt-img-test/blob/main/pages/index.vue#L7 and you should be able to see the error.
The project can be viewed: https://github.com/AAA55555/nuxt-img-test/tree/main
I have a similar error with nuxt generate using @nuxt/image 1.7.0. Removing all <nuxt-picture> in my app stops it from crashing. However unlike @AAA55555, using a different image file doesn't make a difference.
It only happens when running on linux x64, both on Vercel and GitHub Codespaces. When I run the command locally on my MacBook Pro M2 with Sonoma, it works juste fine.
I randomly get slightly different error messages:
Initializing prerenderer
Prerendering 4 initial routes with crawler
├─ /200.html (74ms)
├─ /404.html (75ms)
├─ /api/_content/cache.1722784400986.json (164ms)
├─ / (216ms)
free(): invalid size
Aborted (core dumped)
ELIFECYCLE Command failed with exit code 134.
Initializing prerenderer
Prerendering 4 initial routes with crawler
├─ /200.html (60ms)
├─ /404.html (60ms)
├─ /api/_content/cache.1722786502708.json (142ms)
├─ / (181ms)
├─ /api/_content/query/3Mj3u8TI8e.1722786502708.json (10ms)
free(): invalid size
free(): invalid size
Aborted (core dumped)
ELIFECYCLE Command failed with exit code 134.
Initializing prerenderer
Prerendering 4 initial routes with crawler
├─ /200.html (63ms)
├─ /404.html (64ms)
├─ /api/_content/cache.1722772503868.json (155ms)
├─ / (209ms)
├─ /api/_content/query/3Mj3u8TI8e.1722772503868.json (14ms)
munmap_chunk(): invalid pointer
ELIFECYCLE Command failed.
Closing as the initial problem seems to be solved
@juliendargelos if you still wncounter this issue, please create a new issue :)