question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invalid next size (fast) - ARMv7 - Raspbian GNU/Linux 9 (stretch)

See original GitHub issue

Hi, I’m having an error with sharp on my raspberry pi, the same code works flawlessly with the same sharp version on my macbook. Here’s the error:

*** Error in '/usr/local/bin/node': free(): invalid next size (fast): 0x71700dd8 ***

And heres the code:

//CREATE PLACEHOLDER IMAGE
sharp(fileUrl)
    .rotate()
    .resize(pDimension.width, pDimension.height)
    .jpeg({
        progressive: true,
        quality: 20,
        optimiseScans: true
    })
    .blur(2)
    .toFile(imageDirectory + "/" + imageName + "_p" + imageExt)
    .then(function () {
        finished();
    })
    .catch(err => console.log("Resize Err: "+err));

I have tried installing sharp without preinstalling libvips and then installing sharp with preinstall libvips and --sharpcxx11=1. Then i have tried to change _GLIBCXX_USE_CXX11_ABI=1 in binding.gyp with npm rebuild. Also i have tried node version 9, 10.0.0, 10.8.0 and 10.9.0.

gdp backtrace

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x76c51824 in __GI_abort () at abort.c:89
#2  0x76c8af78 in __libc_message (do_abort=do_abort@entry=2, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:175
#3  0x76c91ad4 in malloc_printerr (action=<optimized out>, str=0x76d43ffc "free(): invalid next size (fast)", ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5049
#4  0x76c92514 in _int_free (av=0x76d60794 <main_arena>, p=0x71600dd0, have_lock=<optimized out>) at malloc.c:3905
#5  0x7489337c in vips::VOption::~VOption() () from /var/www/ravenclaws/node_modules/sharp/build/Release/../../vendor/lib/libvips-cpp.so.42
#6  0x748933a0 in vips::VOption::~VOption() () from /var/www/ravenclaws/node_modules/sharp/build/Release/../../vendor/lib/libvips-cpp.so.42
#7  0x748939cc in vips::VImage::call_option_string(char const*, char const*, vips::VOption*) () from /var/www/ravenclaws/node_modules/sharp/build/Release/../../vendor/lib/libvips-cpp.so.42
#8  0x7489fc64 in vips::VImage::new_from_file(char const*, vips::VOption*) () from /var/www/ravenclaws/node_modules/sharp/build/Release/../../vendor/lib/libvips-cpp.so.42
#9  0x748c7f7c in sharp::OpenInput(sharp::InputDescriptor*, VipsAccess) () from /var/www/ravenclaws/node_modules/sharp/build/Release/sharp.node
#10 0x748df4e8 in PipelineWorker::Execute() () from /var/www/ravenclaws/node_modules/sharp/build/Release/sharp.node
#11 0x005ac86c in worker (arg=0x0) at ../deps/uv/src/threadpool.c:83
#12 0x76d69fc4 in start_thread (arg=0x72135450) at pthread_create.c:335
Backtrace stopped: Cannot access memory at address 0x2

General Information

CPU: ARMv7 Processor rev 4 (v7l)

OS: Linux version 4.14.50-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611))

node: v10.9.0

npm: 6.2.0

sharp.versions: { cairo: '1.14.12', croco: '0.6.12', exif: '0.6.21', expat: '2.2.5', ffi: '3.2.1', fontconfig: '2.12.6', freetype: '2.9', gdkpixbuf: '2.36.11', gif: '5.1.4', glib: '2.55.1', gsf: '1.14.42', harfbuzz: '1.7.4', jpeg: '1.5.3', lcms: '2.9-', orc: '0.4.28', pango: '1.41.0', pixman: '0.34.0', png: '1.6.34', svg: '2.42.0', tiff: '4.0.9-cda4b06', vips: '8.6.1', webp: '0.6.1', xml: '2.9.7', zlib: '1.2.11' }

Any help would be greatly appreciated,

Cheers Max

PS(Edit): The code is running in a seperate thread Edit2: npm rebuild not reinstall

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Aug 29, 2018

The pre-compiled libvips v8.6.1 for ARMv7 was erroneously compiled without setting _GLIBCXX_USE_CXX11_ABI and the compiler assigned an implicit value of 1 but sharp assumes these will be 0.

To work around this until sharp v0.21.0 is out, re-compiling sharp with an explicit 1 value should fix this (as it did with #1336). It sounds like you did the right thing so I’m a little surprised there’s still a problem. Did you change line 120 (assuming sharp v0.20.7)? https://github.com/lovell/sharp/blob/v0.20.7/binding.gyp#L120

1reaction
lovellcommented, Aug 29, 2018

Hello, did you see #1336? This definitely looks like a mismatch in the value of _GLIBCXX_USE_CXX11_ABI between libvips and sharp.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: free(): invalid next size (fast): - Stack Overflow
It means that you have a memory error. You may be trying to free a pointer that wasn't allocated by malloc (or delete...
Read more >
RB PI 4 4GB Booting but USB not working
Hello everyone, I have a Raspberry Pi4 fresh out of the box with a preinstalled noobs on SD card. Mouse and keyboard are...
Read more >
Bullseye - the new version of Raspberry Pi OS
New camera driver. The driver used by Raspberry Pi to access camera modules has now been replaced with libcamera, a standard Linux API....
Read more >
Network does not come up when restarting
I have a Raspberry Pi acting as a NextCloudPi server and it's been down regularly of late. I'm scheduling a rebuild but I...
Read more >
Assembler questions - Raspberry Pi Forums
ARMv7 adds 32-bit Thumb2 instructions, and it's a stretch to call it a ... The gnu assembler as with many assemblers did some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found