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

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

Closed
jim-fx opened this issue Aug 28, 2018 · 5 comments
Closed

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

jim-fx opened this issue Aug 28, 2018 · 5 comments
Labels

Comments

@jim-fx
Copy link

jim-fx commented Aug 28, 2018

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

@lovell
Copy link
Owner

lovell commented 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.

@jim-fx
Copy link
Author

jim-fx commented Aug 29, 2018

Yes, i went trough the steps described in that issue, so i changed _GLIBCXX_USE_CXX11_ABI=0 to _GLIBCXX_USE_CXX11_ABI=1 in binding.gyp and than called npm rebuildbut the error still persisted. Was that correct, or what exactly do you mean by "mismatch".

Thank you for the help,
Cheers, Max

Edit: spelling

@lovell
Copy link
Owner

lovell commented 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

@jim-fx
Copy link
Author

jim-fx commented Aug 30, 2018

I think i found the problem, i changed the line above where it says:
'_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt

To:
'_GLIBCXX_USE_CXX11_ABI=1#<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt

So it was (as usually) a human error. I can't test right now but i will report as soon as i get home.

I'm very thankful for your help and your amazing library.

Cheers, Max

@jim-fx
Copy link
Author

jim-fx commented Aug 30, 2018

Okay, it worked!

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

No branches or pull requests

2 participants