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

Segfaults when under pressure? #1986

Closed
pvdz opened this issue Nov 26, 2019 · 58 comments
Closed

Segfaults when under pressure? #1986

pvdz opened this issue Nov 26, 2019 · 58 comments

Comments

@pvdz
Copy link

pvdz commented Nov 26, 2019

I'm trying to debug a segfault while using Gatsby that is potentially in the realm of using sharp.

(I'm a performance eng for Gatsby)

It seems that sites with lots of images can trigger a segfault and we're not sure when exactly this happens.

I get this fairly frequently with a simple site that just has many images (~1500 for my machine) on the example site posted (in http://github.com/gatsbyjs/gatsby/pull/6291) as a repro;

Clone https://github.com/jp887/gatsby-issue6291-repro
Update package.json to set all gatsby deps to *
Clear the npm cache (~/.npm)
Clear node_modules, in case that's relevant
npm install
yarn gen-images 1500 (It triggers with 1500 images for me, this will try to process 9000 images in total)
gatsby build

For me, often it segfaults roughly between 25% and 75%.

I'm on ubuntu (xfce) 19.10
Node v8.16.2 (through nvm)

I went through some of the older Gatsby issues relating to this bug. I am able to reproduce it with .simd(true) and .simd(false), and same for .cache(true) and .cache(false).

Reducing the available memory to node does not seem to make a difference (I set it to 500mb, half of the default, but saw no increase in crash rate). Was also able to repro it running single core.

Please let me know how I can help :)

@pvdz pvdz added the triage label Nov 26, 2019
@lovell
Copy link
Owner

lovell commented Nov 26, 2019

Hi Peter, I previously helped one of the organisations experiencing the problems reported in gatsbyjs/gatsby#6291 and there's a summary of the findings in gatsbyjs/gatsby#6291 (comment)

Thanks for bringing it to my attention again. By stressing my machine with other CPU-bound processes at the same time until it overheated and throttled the clock rate, I finally managed to reproduce a crash and get a backtrace using the latest sharp v0.23.3, its vendored copy of libvips v8.8.1 and the latest Node.js LTS v12.13.1.

(sharp:16801): GLib-GObject-WARNING **: 16:50:33.759: gtype.c:4265: type id '0' is invalid

(sharp:16801): GLib-GObject-WARNING **: 16:50:33.759: can't peek value table for type '<invalid>' which is not currently referenced

(sharp:16801): GLib-GObject-WARNING **: 16:50:33.762: gvalue.c:188: cannot initialize GValue with type '(null)', this type has no GTypeValueTable implementation
[Thread 0x7fff9affd700 (LWP 7136) exited]

Thread 10 "node" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd6ffc700 (LWP 17345)]
0x00007fffd52c27d7 in g_type_check_value () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libgobject-2.0.so.0
(gdb) bt
#0  0x00007fffd52c27d7 in g_type_check_value () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libgobject-2.0.so.0
#1  0x00007fffd52c54e3 in g_value_transform () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libgobject-2.0.so.0
#2  0x00007fffd5a3fe97 in ?? () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#3  0x00007fffd5a3ff07 in ?? () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#4  0x00007fffd5a50485 in vips_slist_map2 () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#5  0x00007fffd5a405a4 in vips.image_copy_fields_array () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#6  0x00007fffd5a3b262 in vips_image_pipeline_array () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#7  0x00007fffd5a3b363 in vips_image_pipelinev () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#8  0x00007fffd5939a16 in ?? () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#9  0x00007fffd5a31b29 in vips_object_build () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#10 0x00007fffd5a3cf98 in vips_cache_operation_buildp () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#11 0x00007fffd5a4339d in vips_call_required_optional () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#12 0x00007fffd5a43eaf in vips_call_split () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#13 0x00007fffd5939d89 in vips_copy () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#14 0x00007fffd5a383dd in vips_image_decode () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#15 0x00007fffd589e075 in ?? () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#16 0x00007fffd5a31b29 in vips_object_build () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#17 0x00007fffd5a3cf98 in vips_cache_operation_buildp () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#18 0x00007fffd5a4339d in vips_call_required_optional () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#19 0x00007fffd5a43eaf in vips_call_split () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#20 0x00007fffd589e9f7 in vips_reducev () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#21 0x00007fffd58954e5 in ?? () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#22 0x00007fffd5a31b29 in vips_object_build () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#23 0x00007fffd5a3cf98 in vips_cache_operation_buildp () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips.so.42
#24 0x00007ffff41fe905 in vips::VImage::call_option_string(char const*, char const*, vips::VOption*) ()
   from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips-cpp.so.42
#25 0x00007ffff4210ee3 in vips::VImage::resize(double, vips::VOption*) const () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/../../vendor/lib/libvips-cpp.so.42
#26 0x00007ffff444d7b1 in PipelineWorker::Execute() () from /gatsby-issue6291-repro/node_modules/sharp/build/Release/sharp.node
#27 0x00000000012d1c0e in worker (arg=0x0) at ../deps/uv/src/threadpool.c:122
#28 0x00007ffff7c42182 in start_thread (arg=<optimised out>) at pthread_create.c:486
#29 0x00007ffff7b6bb1f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

From what I can tell, the Gatsby build process is queuing filesystem-based input images one-at-a-time then attempting to concurrently generate 6 output images to memory, resized in various dimensions. All of these images are JPEGs.

sharp uses libuv-managed threads, which by default will limit this to 4 concurrently (and queue the other 2). It looks like Gatsby calls sharp.concurrency() and therefore vips_concurrency_set with the physical core count, so I think that's 12 concurrent threads accessing the same input image on a typical "4 core" CPU with hyper-threading.

If I set the GATSBY_CPU_COUNT=1 environment variable, which Gatsby uses to call sharp.concurrency(1) and therefore vips_concurrency_set(1) I cannot get it to crash, which suggests a possible threading problem. Setting GATSBY_CPU_COUNT=1 was part of the summary of gatsbyjs/gatsby#6291 (comment) although in that context was due to CircleCI incorrectly reporting physical CPU core counts.

@jcupitt Can you see any possible thread-safety issues in this backtrace? Perhaps something in vips__image_copy_fields_array and vips__gslist_gvalue_merge?

I'll attempt to get it to crash with a debug build of libvips to try to discover which functions the ?? in the backtrace refer to.

@pvdz
Copy link
Author

pvdz commented Nov 26, 2019

Hi. I'm really happy to hear you were able to get a repro AND trace, as I was unable to get the trace.

I will try to go through the code in Gatsby tomorrow and see how we can improve that situation. I don't think it should be hammering the process like that in the first place as that has different perf implications as well.

By stressing my machine with other CPU-bound processes at the same time until it overheated and throttled the clock rate, I finally managed to reproduce a crash

That's interesting because on my machine, this happens all the time (whenever I trigger any computation) and have these messages in my logs every time. So perhaps the problem is related to clock throttling and stressing.

Anyways. Happy to hear you have a repro and hoping it'll improve the situation :)

@pvdz
Copy link
Author

pvdz commented Nov 26, 2019

(Perhaps my test with single cpu was botched, I can't say for sure right now, so take that with a grain of salt)

@lovell
Copy link
Owner

lovell commented Nov 26, 2019

Here's a more detailed backtrace using the latest libvips master branch compiled from source:

#0  0x00007ffff405f047 in g_type_check_value () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#1  0x00007ffff4061d53 in g_value_transform () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#2  0x00007ffff420a9d7 in meta_new (image=0x7fffc8068640, name=0x7fffb40008d0 "\020\"", value=0x7fffd002de70) at header.c:325
#3  0x00007ffff420aa47 in meta_cp_field (meta=<optimised out>, dst=<optimised out>) at header.c:916
#4  0x00007ffff42144f5 in vips_slist_map2 (list=<optimised out>, fn=fn@entry=0x7ffff420aa30 <meta_cp_field>, a=a@entry=0x7fffc8068640, b=b@entry=0x0) at util.c:129
#5  0x00007ffff420b114 in meta_cp (src=0x7fffc00aa4d0, dst=0x7fffc8068640) at header.c:934
#6  0x00007ffff420b114 in vips__image_copy_fields_array (out=out@entry=0x7fffc8068640, in=in@entry=0x7fffd7ffae00) at header.c:981
#7  0x00007ffff4205e92 in vips_image_pipeline_array (image=image@entry=0x7fffc8068640, hint=hint@entry=VIPS_DEMAND_STYLE_THINSTRIP, in=in@entry=0x7fffd7ffae00) at generate.c:395
#8  0x00007ffff4205f9f in vips_image_pipelinev (image=0x7fffc8068640, hint=hint@entry=VIPS_DEMAND_STYLE_THINSTRIP) at generate.c:435
#9  0x00007ffff4153459 in vips_copy_build (object=0x7fff60070380) at copy.c:183
#10 0x00007ffff41fbdd9 in vips_object_build (object=0x7fff60070380) at object.c:367
#11 0x00007ffff4207ce8 in vips_cache_operation_buildp (operation=0x7fffd7ffd160) at cache.c:866
#12 0x00007ffff4207ce8 in vips_cache_operation_buildp (operation=operation@entry=0x7fffd7ffd160) at cache.c:842
#13 0x00007ffff420dd5d in vips_call_required_optional (operation=operation@entry=0x7fffd7ffd160, required=required@entry=0x7fffd7ffd190, optional=optional@entry=0x7fffd7ffd270) at operation.c:880
#14 0x00007ffff420e466 in vips_call_by_name (operation_name=<optimised out>, option_string=option_string@entry=0x0, required=required@entry=0x7fffd7ffd190, optional=optional@entry=0x7fffd7ffd270)
    at operation.c:920
#15 0x00007ffff420e8b9 in vips_call_split (operation_name=operation_name@entry=0x7ffff4245ff6 "copy", optional=optional@entry=0x7fffd7ffd270) at operation.c:1024
#16 0x00007ffff41537c6 in vips_copy (in=in@entry=0x7fffc00aa4d0, out=out@entry=0x7fffd00d8e30) at copy.c:399
#17 0x00007ffff4202f6d in vips_image_decode (in=in@entry=0x7fffc00aa4d0, out=out@entry=0x7fffd00d8e30) at image.c:2910
#18 0x00007ffff40edf45 in vips_reducev_build(VipsObject*) (object=0x7fffd00d84c0) at reducev.cpp:860
#19 0x00007ffff41fbdd9 in vips_object_build (object=0x7fffd00d84c0) at object.c:367
#20 0x00007ffff4207ce8 in vips_cache_operation_buildp (operation=0x7fffd7ffd550) at cache.c:866
#21 0x00007ffff4207ce8 in vips_cache_operation_buildp (operation=operation@entry=0x7fffd7ffd550) at cache.c:842
#22 0x00007ffff420dd5d in vips_call_required_optional (operation=operation@entry=0x7fffd7ffd550, required=required@entry=0x7fffd7ffd580, optional=optional@entry=0x7fffd7ffd660) at operation.c:880
#23 0x00007ffff420e466 in vips_call_by_name (operation_name=<optimised out>, option_string=option_string@entry=0x0, required=required@entry=0x7fffd7ffd580, optional=optional@entry=0x7fffd7ffd660)
    at operation.c:920
#24 0x00007ffff420e8b9 in vips_call_split (operation_name=operation_name@entry=0x7ffff423f420 "reducev", optional=optional@entry=0x7fffd7ffd660) at operation.c:1024
#25 0x00007ffff40ee574 in vips_reducev(VipsImage*, VipsImage**, double, ...) (in=in@entry=0x7fffc00aa4d0, out=out@entry=0x7fffd0045b60, vshrink=vshrink@entry=1.0666666666666667) at reducev.cpp:976
#26 0x00007ffff40e64d5 in vips_resize_build (object=0x7fff6c0c08b0) at resize.c:227
#27 0x00007ffff41fbdd9 in vips_object_build (object=0x7fff6c0c08b0) at object.c:367
#28 0x00007ffff4207ce8 in vips_cache_operation_buildp (operation=0x7fffd7ffd810) at cache.c:866
#29 0x00007ffff4207ce8 in vips_cache_operation_buildp (operation=operation@entry=0x7fffd7ffd810) at cache.c:842
#30 0x00007ffff4581b50 in vips::VImage::call_option_string(char const*, char const*, vips::VOption*) (operation_name=<optimised out>, option_string=0x0, options=0x7fffd002d8f0) at VImage.cpp:513
#31 0x00007ffff4597e43 in vips::VImage::resize(double, vips::VOption*) const (this=0x7fffd7ffd908, scale=0.9375, options=<optimised out>) at ../cplusplus/include/vips/VImage8.h:108
#32 0x00007ffff45fab5c in PipelineWorker::Execute() () at /gatsby-issue6291-repro/node_modules/sharp/build/Release/sharp.node
#33 0x00000000012d1c0e in worker (arg=0x0) at ../deps/uv/src/threadpool.c:122
#34 0x00007ffff7c42182 in start_thread (arg=<optimised out>) at pthread_create.c:486
#35 0x00007ffff7b6bb1f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

@jcupitt
Copy link
Contributor

jcupitt commented Nov 27, 2019

That's very interesting. I'll have a look today.

@jcupitt
Copy link
Contributor

jcupitt commented Nov 27, 2019

I think I found what's making those message before the crash:

https://github.com/libvips/libvips/blob/master/libvips/iofuncs/header.c#L311

If you change that to be:

        /*
        if( G_VALUE_TYPE( value ) == G_TYPE_STRING )
                g_value_init( &meta->value, VIPS_TYPE_REF_STRING );
        else
                g_value_init( &meta->value, G_VALUE_TYPE( value ) );
         */

        g_value_init( &meta->value, 0 );

And try vips copy x.jpg y.jpg you see:

$ vips copy k2.jpg x.v

(vips:14583): GLib-GObject-WARNING **: 16:33:11.184: ../../../gobject/gtype.c:4268: type id '0' is invalid

(vips:14583): GLib-GObject-WARNING **: 16:33:11.184: can't peek value table for type '<invalid>' which is not currently referenced

(vips:14583): GLib-GObject-WARNING **: 16:33:11.184: ../../../gobject/gvalue.c:185: cannot initialize GValue with type '(null)', this type has no GTypeValueTable implementation

The same set of errors, so probably the value param to meta_new() is pointing at a lot of zeros.

meta_cp takes a shallow copy of the list of metadata items on each input image, then calls meta_new() for each item. A metadata item is disappearing (probably) some time between the shallow copy of the list and calling meta_new().

This could be caused by an image being unreffed during the copy, but that seems unlikely to me, the chaos would be even worse.

It's more likely that some other thread is changing the metadata on the input image during the copy. Could this be happening?

libvips images have a list of arbitrary name/value pairs attached to them, and these are inherited as images are processed. They are used for things like ICC profiles and EXIF data, but user code can add extra metadata too if it's convenient. Image metadata is supposed to be immutable: after the image has been constructed, it's all frozen and must not be changed or you get bad behaviour like this.

However, at the moment, there's no lock mechanism to prevent you changing image metadata. How about adding something to enforce this? It could be very simple, eg:

void
vips_image_set( VipsImage *image, const char *name, GValue *value )
{
        g_assert( name );
        g_assert( value );

        /* If this image is shared, block metadata changes.  
         */
        if( G_OBJECT( image )->ref_count > 1 ) {
                g_info( "can't set metadata \"%s\" on shared image", name );
                return;
        }       
                        
        meta_init( image );
        (void) meta_new( image, name, value );

... etc.

@lovell
Copy link
Owner

lovell commented Nov 27, 2019

Thanks John, amazing debugging skills there as always.

If I add your suggestion to libvips and run the sharp test suite against it I see things like:

can't set metadata "exif-data" on shared image
can't set metadata "hide-progress" on shared image
can't set metadata "offset" on shared image

which led me to a few possible sources within libvips:

https://github.com/libvips/libvips/blob/master/libvips/foreign/jpeg2vips.c#L613
https://github.com/libvips/libvips/blob/master/libvips/foreign/dzsave.c#L599
https://github.com/libvips/libvips/blob/master/libvips/convolution/convi.c#L841

Next step (for me) is to try to reproduce the original crash with this extra debugging in place.

@jcupitt
Copy link
Contributor

jcupitt commented Nov 27, 2019

Yes, bits of the test suite fail too, I'll fix them.

@lovell
Copy link
Owner

lovell commented Nov 27, 2019

Thanks John, I also added this debug to vips_image_remove() and found the following occurrence:

https://github.com/libvips/libvips/blob/master/libvips/colour/profile_load.c#L208

@lovell
Copy link
Owner

lovell commented Nov 27, 2019

Commit bb15cd9 ensures sharp always takes a copy before updating/removing metadata.

@lovell lovell added this to the v0.23.4 milestone Nov 27, 2019
jcupitt added a commit to libvips/libvips that referenced this issue Nov 28, 2019
If images are shared (ref count > 1), block changes to the set of
metadata items on the image. These can cause crashes in highly threaded
programs.

See lovell/sharp#1986
@jcupitt
Copy link
Contributor

jcupitt commented Nov 28, 2019

I made a PR to gather up any changes libvips needs for this. Please push any related patches there. I put your nice _remove one in.

libvips/libvips#1483

jcupitt added a commit to libvips/libvips that referenced this issue Nov 28, 2019
During write, we often call vips__exif_update(). This updates the exif
block from the other image metadata prior to save.

Always copy the image before calling this.

See lovell/sharp#1986
@jcupitt
Copy link
Contributor

jcupitt commented Nov 28, 2019

I found a couple of places in libvips which were breaking the "metadata is frozen" rule.

The big one was vips__exif_update(): this merges other metadata fields into the exif block and is called before a save to formats that support exif. I think this is a plausible cause of these crashes: if one thread updates the exif block while another thread is trying to take a copy of the image metadata you'd see something like this.

I'll backport libvips/libvips#1483 (but not the locks on metadata changes) to current stable 8.8 and it should be easy to test.

jcupitt added a commit to libvips/libvips that referenced this issue Nov 28, 2019
During write, we often call vips__exif_update(). This updates the exif
block from the other image metadata prior to save.

Always copy the image before calling this.

See lovell/sharp#1986
@jcupitt
Copy link
Contributor

jcupitt commented Nov 28, 2019

OK, the head of 8.8 (it's 8.8.4 at the moment) includes this change to metadata handling and (I hope!) should be easy to test.

@lovell
Copy link
Owner

lovell commented Nov 28, 2019

Brilliant, thanks John, I've been unable to reproduce a segfault using the check-metadata-changes branch of libvips with the latest master branch of sharp.

@lovell lovell modified the milestones: v0.23.4, v0.24.0 Nov 28, 2019
@jcupitt
Copy link
Contributor

jcupitt commented Nov 28, 2019

That's great!

@pvdz would you be able to test 8.8.4? It should be a drop-in replacement for your current libvips.

@jcupitt
Copy link
Contributor

jcupitt commented Nov 29, 2019

(or are there related sharp changes that would be needed too, Lovell?)

@lovell
Copy link
Owner

lovell commented Nov 29, 2019

I found a couple of places in sharp that could potentially cause this problem, addressed in bb15cd9, which will be in sharp v0.23.4.

@lovell
Copy link
Owner

lovell commented Jan 18, 2020

@jcupitt Brilliant, thanks John.

@pvdz In terms of semver, sharp is at major version zero, which means breaking changes such as removal of support for Node.js 8 arrive in minor increments and remain compliant with e.g. use of the ^ range selector.

The removal of support for Node.js 8 unblocks #1282, which I believe is of interest to Gatsby amongst many others. The ABI stability that N-API will (hopefully) bring is pretty much the last remaining task before we organise the "sharp version 1" release party.

@jcupitt
Copy link
Contributor

jcupitt commented Jan 18, 2020 via email

@jaubourg
Copy link
Contributor

Does it have to be a global mutex though @jcupitt ?

Can't it possibly be one mutex per object at which level metadata are abstracted in libvips?

Unless the metadata lib is not thread-safe itself?

@jcupitt
Copy link
Contributor

jcupitt commented Jan 18, 2020 via email

@jcupitt
Copy link
Contributor

jcupitt commented Jan 21, 2020

I made a branch with locks for set / remove / copy. Hopefully this will resolve the crash, or at least change the stack trace.

Let's remove this hack and add some new API for 8.10.

jcupitt added a commit to libvips/libvips that referenced this issue Jan 21, 2020
Another attempt at fixing crashes on metadata chenage in highly threaded
applications.

Global lock around set, remove and copy metadata. This is crude, but
simple, the performance impact should be small, and ought to resolve the
problem.

We'll do something better for the next version.

see lovell/sharp#1986
@jcupitt
Copy link
Contributor

jcupitt commented Jan 21, 2020

@lovell
Copy link
Owner

lovell commented Jan 22, 2020

I can no longer reproduce this problem when using libvips compiled from the lock-for-metadata-changes branch.

@jcupitt
Copy link
Contributor

jcupitt commented Jan 22, 2020

That's great!

@pvdz if you give a thumbs-up as well, let's push out 8.9.1 with this fix.

@pvdz
Copy link
Author

pvdz commented Jan 27, 2020

I'm a little busy to dig deep I'm afraid.

Would suggest to push this as is. Sounds some things have been fixed and that's an improvement regardless. If I can repro it later I'll report back.

Thanks!

@jcupitt
Copy link
Contributor

jcupitt commented Jan 28, 2020

OK, let's merge and make 8.9.1.

@oezi
Copy link

oezi commented Feb 6, 2020

@lovell with libvips v8.9.1 available now, can we get a sharp v0.24.1 containing the updated dependency? i'd love to see these segfaults gone ;)

@lovell
Copy link
Owner

lovell commented Feb 6, 2020

@oezi sharp will always look for and use a globally-installed libvips in preference to its prebuilt copy to allow you to use a newer libvips with an older sharp.

@pvdz
Copy link
Author

pvdz commented Feb 11, 2020

If you could also release 8.9.1 in https://github.com/lovell/sharp-libvips/releases I can test it. Or another easy way to temporarily get a contained build (on linux, ubuntu) to test drive. I'm fine with inline replacing the cached 8.9.0 file with a new version as a workaround.

Not sure what your release schedule is/was here? :)

@pvdz
Copy link
Author

pvdz commented Feb 20, 2020

@lovell can you give us any update on this, please?

@lovell
Copy link
Owner

lovell commented Feb 20, 2020

The yield branch that will become the forthcoming sharp v0.25.0 depends on and provides libvips v8.9.1.

npm i lovell/sharp#yield

sharp v0.25.0 will also include the N-API migration (see #1282) as well as the return of support for 32-bit node.exe on Windows to allow for easier use with Azure.

@pvdz
Copy link
Author

pvdz commented Feb 26, 2020

It seems I can no longer trigger the problem on this branch. 30 or 40 runs on high system load (aka a Zoom call, lol) without signs of trouble. Thank you!
(While the repro above was for about 9k thumbs, I was also able to successfully generate 30k thumbnails, back to back, without signs of the problem)

@Umkus
Copy link

Umkus commented Feb 26, 2020

Can confirm, no more segfaults with the yield branch.

@jcupitt
Copy link
Contributor

jcupitt commented Feb 27, 2020

This is great news, thank you very much for testing!

@lovell
Copy link
Owner

lovell commented Mar 7, 2020

sharp v0.25.0 with libvips v8.9.1 is now available; enjoy!

@lovell lovell closed this as completed Mar 7, 2020
@pvdz
Copy link
Author

pvdz commented Mar 7, 2020

Awesome. Thanks for the effort on your end(s)! :D We expect to upgrade soon and ship this as well.

klehmann added a commit to klehmann/imageresizer-libvips that referenced this issue Mar 9, 2020
@pvdz
Copy link
Author

pvdz commented Mar 20, 2020

We've now bumped Sharp in Gatsby, affecting the following versions. Thanks again!

  • gatsby-plugin-manifest@2.3.1
  • gatsby-plugin-sharp@2.5.1
  • gatsby-remark-images-contentful@2.2.1
  • gatsby-source-contentful@2.2.2
  • gatsby-theme-blog-core@1.3.2
  • gatsby-theme-blog@1.4.2
  • gatsby-theme-notes@1.2.2
  • gatsby-transformer-sharp@2.4.1
  • gatsby-transformer-sqip@2.2.1
  • gatsby@2.20.2

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

No branches or pull requests

7 participants