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

Sharp Crash - libvips_42 - windbg - FAST_FAIL_FATAL_APP_EXIT #4041

Closed
RyAndrew opened this issue Mar 25, 2024 · 9 comments
Closed

Sharp Crash - libvips_42 - windbg - FAST_FAIL_FATAL_APP_EXIT #4041

RyAndrew opened this issue Mar 25, 2024 · 9 comments
Labels

Comments

@RyAndrew
Copy link

RyAndrew commented Mar 25, 2024

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • [ X] Running npm install sharp completes without error.
  • [ X] Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • [ X] I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 8.09 GB / 15.79 GB
  Binaries:
    Node: 18.19.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    sharp: ^0.33.3 => 0.33.3

What are the steps to reproduce?

run my program, generate a bunch of thumbnails, it will crash randomly

What is the expected behaviour?

not crashing

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

I am running this code. https://github.com/RyAndrew/amc-buddy
It pulls images from email and it is crashing when I scroll through the web page and it generates thumbnails on the fly. It doesn't crash on a specific image, but it appears to be resource related in some way.

I tried adding sharp.simd(false) but that did not resolve the issue

This is the offending line performing the resize operation:

await sharp(originalFile,{failOn:'error'}).resize(450, 253).toFile(thumbFile)

This line contains failOn:'error' because the images will sometimes have warnings.

Please provide sample image(s) that help explain this problem

Sample Image: https://github.com/lovell/sharp/assets/3945391/c739f442-d1ed-45d1-83d2-3566c2ba8f30

I captured a procdump but I couldn't figure out how to load the symbols into windbg
app.js-1.dmp

COMMENT:  
*** "C:\procdump\procdump.exe" -e 1 -f  -x node.exe app.js
*** Unhandled exception: C0000409

NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

CONTEXT:  (.ecxr)
rax=0000000000000001 rbx=000000bbb5bfdc70 rcx=0000000000000007
rdx=000000000000000f rsi=000000000000011e rdi=0000000000000115
rip=00007ffbd280286e rsp=000000bbb5bfd6a0 rbp=000000000000011e
 r8=0000000000000001  r9=000000bbb5bfd648 r10=0000000000000012
r11=8101010101010100 r12=00007ffbd27a3440 r13=0000000000000000
r14=000000bbb5bfdc70 r15=0000000000000000
iopl=0         nv up ei pl nz na pe nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202
ucrtbase!abort+0x4e:
00007ffb`d280286e cd29            int     29h
Resetting default scope

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ffbd280286e (ucrtbase!abort+0x000000000000004e)
   ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
  ExceptionFlags: 00000001
NumberParameters: 1
   Parameter[0]: 0000000000000007
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 

PROCESS_NAME:  node.exe

ERROR_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.

EXCEPTION_CODE_STR:  c0000409

EXCEPTION_PARAMETER1:  0000000000000007

FAULTING_THREAD:  000026a4

STACK_TEXT:  
000000bb`b5bfd6a0 00007ffb`72278b6e     : 00000000`00000003 00000000`00000003 00007ffb`72ff4d90 000000bb`b5bfd678 : ucrtbase!abort+0x4e
000000bb`b5bfd6d0 00000000`00000003     : 00000000`00000003 00007ffb`72ff4d90 000000bb`b5bfd678 0073006f`00700065 : libvips_42+0x5e8b6e
000000bb`b5bfd6d8 00000000`00000003     : 00007ffb`72ff4d90 000000bb`b5bfd678 0073006f`00700065 0063006d`0061005c : 0x3
000000bb`b5bfd6e0 00007ffb`72ff4d90     : 000000bb`b5bfd678 0073006f`00700065 0063006d`0061005c 00000000`00000000 : 0x3
000000bb`b5bfd6e8 000000bb`b5bfd678     : 0073006f`00700065 0063006d`0061005c 00000000`00000000 0070005c`00790064 : libvips_42+0x1364d90
000000bb`b5bfd6f0 0073006f`00700065     : 0063006d`0061005c 00000000`00000000 0070005c`00790064 006f0074`006f0068 : 0x000000bb`b5bfd678
000000bb`b5bfd6f8 0063006d`0061005c     : 00000000`00000000 0070005c`00790064 006f0074`006f0068 000000bb`b5bfda08 : 0x0073006f`00700065
000000bb`b5bfd700 00000000`00000000     : 0070005c`00790064 006f0074`006f0068 000000bb`b5bfda08 0000021f`a07744f0 : 0x0063006d`0061005c


SYMBOL_NAME:  ucrtbase!abort+4e

MODULE_NAME: ucrtbase

IMAGE_NAME:  ucrtbase.dll

STACK_COMMAND:  ~13s ; .cxr ; kb

FAILURE_BUCKET_ID:  FAIL_FAST_FATAL_APP_EXIT_c0000409_ucrtbase.dll!abort

OS_VERSION:  10.0.19041.1

BUILDLAB_STR:  vb_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

IMAGE_VERSION:  6.2.19041.789

FAILURE_ID_HASH:  {e31753ac-c98a-8055-3663-47e707543d20}

Followup:     MachineOwner
---------

@lovell
Copy link
Owner

lovell commented Mar 25, 2024

I couldn't figure out how to load the symbols into windbg

A full stacktrace would be useful. PDBs to aid debugging are provided for the Windows libvips builds - you'll need the web-static version.

https://github.com/libvips/build-win64-mxe/releases/tag/v8.15.2

I note you're using sqlite3, which is also a native dependency, so it might be worth trying without that if possible.

It also looks like the code in https://github.com/RyAndrew/amc-buddy/blob/main/app.js contains possible race conditions in the event there are concurrent requests with the same value for req.params.thumbname.

@RyAndrew
Copy link
Author

I'm not sure I understand the race condition. Express middleware determines if the thumbnail file exists and if not then generate a thumbnail. Afterwards execution is passed to the express static file server. It could be possible to request the same file simultaneously and I would expect that to lead to a more standard file access/locking error.

I attempted to work around this bug by implementing the express-slow-down package. Thus allowing fewer simultaneous requests and adding a delay to subsequent requests. However I still experienced crashes.

I was able to get windbg to output this after poking around a bit:

Microsoft (R) Windows Debugger Version 10.0.22621.2428 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\ForkRepos\amc-buddy\app.js-4.dmp]
Comment: '
*** "C:\procdump\procdump.exe" -e 1 -f  -x node.exe app.js
*** Unhandled exception: C0000409'
User Mini Dump File: Only registers, stack and portions of memory are available


************* Path validation summary **************
Response                         Time (ms)     Location
OK                                             C:\ForkRepos\amc-buddy\node_modules\@img\sharp-win32-x64\lib
Symbol search path is: srv*
Executable search path is: C:\ForkRepos\amc-buddy\node_modules\@img\sharp-win32-x64\lib
Windows 10 Version 19042 MP (12 procs) Free x64
Product: WinNt, suite: SingleUserTS
Edition build lab: 19041.1.amd64fre.vb_release.191206-1406
Machine Name:
Debug session time: Mon Mar 25 20:43:59.000 2024 (UTC - 5:00)
System Uptime: not available
Process Uptime: 0 days 0:03:42.000
........................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(3e28.3fa0): Security check failure or stack buffer overrun - code c0000409 (first/second chance not available)
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 
For analysis of this file, run !analyze -v
*** WARNING: Unable to verify checksum for libvips-42.dll
ucrtbase!abort+0x4e:
00007ffb`d280286e cd29            int     29h
0:010> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

*** WARNING: Unable to verify checksum for libvips-cpp.dll
*** WARNING: Unable to verify checksum for sharp-win32-x64.node

KEY_VALUES_STRING: 1

    Key  : Analysis.CPU.mSec
    Value: 2655

    Key  : Analysis.DebugAnalysisManager
    Value: Create

    Key  : Analysis.Elapsed.mSec
    Value: 3085

    Key  : Analysis.Init.CPU.mSec
    Value: 1718

    Key  : Analysis.Init.Elapsed.mSec
    Value: 23494

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 218

    Key  : FailFast.Name
    Value: FATAL_APP_EXIT

    Key  : FailFast.Type
    Value: 7

    Key  : Timeline.Process.Start.DeltaSec
    Value: 222

    Key  : WER.OS.Branch
    Value: vb_release

    Key  : WER.OS.Timestamp
    Value: 2019-12-06T14:06:00Z

    Key  : WER.OS.Version
    Value: 10.0.19041.1

    Key  : WER.Process.Version
    Value: 18.19.1.0


FILE_IN_CAB:  app.js-4.dmp

COMMENT:  
*** "C:\procdump\procdump.exe" -e 1 -f  -x node.exe app.js
*** Unhandled exception: C0000409

NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

CONTEXT:  (.ecxr)
rax=0000000000000001 rbx=000000318c9f79c0 rcx=0000000000000007
rdx=000000000000000f rsi=000000000000011e rdi=0000000000000115
rip=00007ffbd280286e rsp=000000318c9f73f0 rbp=000000000000011e
 r8=0000000000000001  r9=000000318c9f7398 r10=0000000000000012
r11=8101010101010100 r12=00007ffbd27a3440 r13=0000000000000000
r14=000000318c9f79c0 r15=0000000000000000
iopl=0         nv up ei pl nz na pe nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202
ucrtbase!abort+0x4e:
00007ffb`d280286e cd29            int     29h
Resetting default scope

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ffbd280286e (ucrtbase!abort+0x000000000000004e)
   ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
  ExceptionFlags: 00000001
NumberParameters: 1
   Parameter[0]: 0000000000000007
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 

PROCESS_NAME:  node.exe

ERROR_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.

EXCEPTION_CODE_STR:  c0000409

EXCEPTION_PARAMETER1:  0000000000000007

FAULTING_THREAD:  00003fa0

STACK_TEXT:  
00000031`8c9f73f0 00007ffb`51c08b6e     : 00000000`00000003 00000000`00000003 00007ffb`52984d90 00000031`8c9f73c8 : ucrtbase!abort+0x4e
00000031`8c9f7420 00007ffb`51a1edcc     : 00000000`00000020 00007ffb`9b2fc04f 00000000`00000010 00007ffb`9b2fdb17 : libvips_42!g_atomic_rc_box_get_size+0x114102
00000031`8c9f7d40 00007ffb`51a26f1d     : 00005de8`392fb953 00000168`99190000 00000000`00000010 00000000`00000000 : libvips_42!g_pattern_match_simple+0x1fb
00000031`8c9f7d90 00007ffb`517da15b     : 00000000`00000010 00007ffb`d279f05b 00000000`00000000 00000000`00000000 : libvips_42!g_vasprintf+0xd
00000031`8c9f7dc0 00007ffb`517d15b3     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000070 : libvips_42!g_strdup_vprintf+0x1f
00000031`8c9f7e00 00007ffb`517d155f     : 00000168`9b1e9ee0 00000000`00000002 00000000`00000000 00007ffb`5237703f : libvips_42!g_logv+0x47
00000031`8c9f7f30 00007ffb`5163289f     : 00000000`00000002 00000000`00000000 00000000`00000001 00007ffb`52984d90 : libvips_42!g_log+0x19
00000031`8c9f7f60 00007ffb`51a31462     : 00000168`99190000 00000168`9b1e9ed0 00000000`00000017 00007ffb`517cc8e2 : libvips_42!vips_jp2ksave_target+0x48f
00000031`8c9f7fa0 00007ffb`51800fca     : 00000168`9b2b5600 00007ffb`51800f70 00000000`00000000 00000000`00000000 : libvips_42!g_closure_invoke+0xa3
00000031`8c9f8020 00007ffb`51800345     : 00000031`8c9f8230 00007ffb`51800327 00000168`00000000 00000168`9b2b5600 : libvips_42!g_clear_signal_handler+0x7b9
00000031`8c9f8160 00007ffb`517ffb22     : 00000168`00000000 00007ffb`517f448b 00000168`9b28d470 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x853
00000031`8c9f8350 00007ffb`5180064b     : 00000168`9b29c7c0 00000168`9b2b5600 00000168`9b002fd0 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x30
00000031`8c9f83a0 00007ffb`5176b7d8     : 00000000`00000000 00000000`00000007 00000168`9b28d470 00000168`9b002fd0 : libvips_42!g_signal_emit+0x19
00000031`8c9f83d0 00007ffb`517f43c6     : 00000000`00000000 00000168`9b654740 00000000`00000001 00007ffb`51a4fdcb : libvips_42!vips_object_get_description+0x5d8
00000031`8c9f8430 00007ffb`516315fc     : 00000000`00000000 00000031`8c9f84f4 00000168`9b65473c 00000168`9b654730 : libvips_42!g_object_unref+0xcd
00000031`8c9f84a0 00007ffb`517f43c6     : 00000000`00000000 00000000`00000000 00000031`8c9f87d0 00000000`00000000 : libvips_42!vips_openslideload_source+0x84c
00000031`8c9f84d0 00007ffb`517f5b0f     : 00000168`9b6a75c0 00007ffb`d4c747b1 00000168`9b66d0a0 00007ffb`d4c75ba1 : libvips_42!g_object_unref+0xcd
00000031`8c9f8540 00007ffb`517f603d     : 00000000`00000002 00000000`00000000 00000168`9b9849b0 00007ffb`517f27d1 : libvips_42!g_object_set_valist+0x26c
00000031`8c9f8630 00007ffb`51768742     : 00000000`00000001 00000031`8c9f8880 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9f8660 00007ffb`51a31462     : 00000168`9d148bc0 00000168`00000000 00000168`9d148580 00007ffb`517cc8e2 : libvips_42!vips_object_get_argument_priority+0x272
00000031`8c9f8690 00007ffb`51800fca     : 00000168`9ba7fb50 00007ffb`51800f70 00000000`00000000 00000000`00000000 : libvips_42!g_closure_invoke+0xa3
00000031`8c9f8710 00007ffb`51800345     : 00000031`8c9f8920 00007ffb`51800327 00000168`00000000 00000168`9ba7fb50 : libvips_42!g_clear_signal_handler+0x7b9
00000031`8c9f8850 00007ffb`517ffb22     : 00000168`00000000 00007ffb`517f448b 00000168`9ba7fb50 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x853
00000031`8c9f8a40 00007ffb`5180064b     : 00000168`9b29c7c0 00000168`9ba7fb50 00000168`9b002fd0 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x30
00000031`8c9f8a90 00007ffb`5176b7d8     : 00000000`00000000 00007ffb`517f7d67 00000168`9e494ed0 00000168`9b002fd0 : libvips_42!g_signal_emit+0x19
00000031`8c9f8ac0 00007ffb`517f43c6     : 00007ffb`528c1a88 00000000`0008d7ff 00007ffb`528c1a88 00000168`9ba7fb50 : libvips_42!vips_object_get_description+0x5d8
00000031`8c9f8b20 00007ffb`517685f5     : 00000000`00000000 00007ffb`52944538 00000168`9b15ba80 00007ffb`52944538 : libvips_42!g_object_unref+0xcd
00000031`8c9f8b90 00007ffb`51768a6f     : 00000002`00000000 00000168`9b002d30 00000168`9e2a8c90 00000031`8c9f8cd8 : libvips_42!vips_object_get_argument_priority+0x125
00000031`8c9f8c20 00007ffb`517f580d     : 00000168`9b20a6e0 00007ffb`517f8d9a 00000168`00000000 00000168`9afb8f1c : libvips_42!vips_object_set_property+0x21f
00000031`8c9f8ca0 00007ffb`517f5a83     : 00000000`00000003 00007ffb`517f6d4d 00000168`00000001 00000168`9e2a8c90 : libvips_42!g_object_setv+0x391
00000031`8c9f8d30 00007ffb`517f603d     : 00000168`9b17a3c0 00000168`9b15ba80 00000168`9e2a8c90 00007ffb`528c2228 : libvips_42!g_object_set_valist+0x1e0
00000031`8c9f8e20 00007ffb`5176b675     : 00000000`00000000 00007ffb`517f45d0 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9f8e50 00007ffb`517f43c6     : 00000000`00000000 00000000`00000000 00000031`8c9f91b0 00000000`00000000 : libvips_42!vips_object_get_description+0x475
00000031`8c9f8eb0 00007ffb`517f5b0f     : 00000000`00a00059 00000000`0000007b 00000168`9b9514c0 00007ffb`d4c75ba1 : libvips_42!g_object_unref+0xcd
00000031`8c9f8f20 00007ffb`517f603d     : 00000000`00000004 00000168`9d147e50 00000168`9b983240 00007ffb`517f27d1 : libvips_42!g_object_set_valist+0x26c
00000031`8c9f9010 00007ffb`51768742     : 00000000`00000001 00000031`00000000 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9f9040 00007ffb`51a31462     : 00000168`9d1485c0 00000168`9d1485c0 00000168`9d1485c0 00007ffb`517cc8e2 : libvips_42!vips_object_get_argument_priority+0x272
00000031`8c9f9070 00007ffb`51800fca     : 00000168`9ba80640 00007ffb`51800f70 00000168`00000000 00007ffb`00000000 : libvips_42!g_closure_invoke+0xa3
00000031`8c9f90f0 00007ffb`51800345     : 00000031`8c9f9300 00007ffb`51800327 00000168`00000000 00000168`9ba80640 : libvips_42!g_clear_signal_handler+0x7b9
00000031`8c9f9230 00007ffb`517ffb22     : 00000168`00000000 00007ffb`517f448b 00000168`9ba80640 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x853
00000031`8c9f9420 00007ffb`5180064b     : 00000168`9b29c7c0 00000168`9ba80640 00000168`9b002fd0 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x30
00000031`8c9f9470 00007ffb`5176b7d8     : 00000000`00000000 00007ffb`517f7d67 00000168`9e493d10 00000168`9b002fd0 : libvips_42!g_signal_emit+0x19
00000031`8c9f94a0 00007ffb`517f43c6     : 00007ffb`528c1a88 00000000`0008d886 00007ffb`528c1a88 00000168`9ba80640 : libvips_42!vips_object_get_description+0x5d8
00000031`8c9f9500 00007ffb`517685f5     : 00000000`00000000 00007ffb`52944538 00000168`9b15ba80 00007ffb`52944538 : libvips_42!g_object_unref+0xcd
00000031`8c9f9570 00007ffb`51768a6f     : 00000002`00000000 00000168`9b002d30 00000168`9e2a8d40 00000031`8c9f96b8 : libvips_42!vips_object_get_argument_priority+0x125
00000031`8c9f9600 00007ffb`517f580d     : 00000168`9b20a6e0 00007ffb`517f8d9a 00000168`00000000 00000168`9afb8f1c : libvips_42!vips_object_set_property+0x21f
00000031`8c9f9680 00007ffb`517f5a83     : 00000000`00000003 00007ffb`517f6d4d 00000168`00000001 00000168`9e2a8d40 : libvips_42!g_object_setv+0x391
00000031`8c9f9710 00007ffb`517f603d     : 00000168`9b17a3c0 00000168`9b15ba80 00000168`9e2a8d40 00007ffb`528c2228 : libvips_42!g_object_set_valist+0x1e0
00000031`8c9f9800 00007ffb`5176b675     : 00000000`00000000 00007ffb`517f45d0 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9f9830 00007ffb`517f43c6     : 00000000`00000000 00000000`00000000 00000031`8c9f9b90 00000000`00000000 : libvips_42!vips_object_get_description+0x475
00000031`8c9f9890 00007ffb`517f5b0f     : 00000000`ffffffff 00000168`9d861e30 00000168`9d661ad0 00007ffb`51a4fdcb : libvips_42!g_object_unref+0xcd
00000031`8c9f9900 00007ffb`517f603d     : 0073006f`00700065 00000031`8c9fb978 00000168`9ceeb200 00007ffb`517f27d1 : libvips_42!g_object_set_valist+0x26c
00000031`8c9f99f0 00007ffb`51768742     : 00320033`00300034 00330037`00300034 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9f9a20 00007ffb`51a31462     : 00630033`00650066 00310034`00370062 00610031`00320031 00007ffb`517cc8e2 : libvips_42!vips_object_get_argument_priority+0x272
00000031`8c9f9a50 00007ffb`51800fca     : 00000168`9ba807d0 00007ffb`51800f70 00000000`00000000 00000000`00000000 : libvips_42!g_closure_invoke+0xa3
00000031`8c9f9ad0 00007ffb`51800345     : 00000031`8c9f9ce0 00007ffb`51800327 00000168`00000000 00000168`9ba807d0 : libvips_42!g_clear_signal_handler+0x7b9
00000031`8c9f9c10 00007ffb`517ffb22     : 00000168`00000000 00007ffb`517f448b 00000168`9ba807d0 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x853
00000031`8c9f9e00 00007ffb`5180064b     : 00000168`9b29c7c0 00000168`9ba807d0 00000168`9b002fd0 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x30
00000031`8c9f9e50 00007ffb`5176b7d8     : 00000000`00000000 00007ffb`517f7d67 00000168`9e493a90 00000168`9b002fd0 : libvips_42!g_signal_emit+0x19
00000031`8c9f9e80 00007ffb`517f43c6     : 00007ffb`528c1a88 00000000`0008d888 00007ffb`528c1a88 00000168`9ba807d0 : libvips_42!vips_object_get_description+0x5d8
00000031`8c9f9ee0 00007ffb`517685f5     : 00000000`00000000 00007ffb`52944538 00000168`9b003530 00007ffb`52944538 : libvips_42!g_object_unref+0xcd
00000031`8c9f9f50 00007ffb`51768a6f     : 00000002`00000000 00000168`9b002d30 00000168`9ac86920 00000031`8c9fa098 : libvips_42!vips_object_get_argument_priority+0x125
00000031`8c9f9fe0 00007ffb`517f580d     : 00000168`9b2099f0 00007ffb`517f8d9a 00000168`00000000 00000168`9afb8f1c : libvips_42!vips_object_set_property+0x21f
00000031`8c9fa060 00007ffb`517f5a83     : 00000000`00000003 00007ffb`517f6d4d 00000168`00000001 00000000`00000000 : libvips_42!g_object_setv+0x391
00000031`8c9fa0f0 00007ffb`517f603d     : 00000168`9b17a7c0 00000168`9b003530 00000168`9ac86920 00007ffb`528c2228 : libvips_42!g_object_set_valist+0x1e0
00000031`8c9fa1e0 00007ffb`5176b675     : 00000000`00000000 00007ffb`517f45d0 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9fa210 00007ffb`517f43c6     : 00000000`00000000 00000000`00000000 00000031`8c9fa570 00000000`00000000 : libvips_42!vips_object_get_description+0x475
00000031`8c9fa270 00007ffb`517f5b0f     : 705c7964`6475622d 3230325c`6f746f68 33373034`32333034 30303730`32363338 : libvips_42!g_object_unref+0xcd
00000031`8c9fa2e0 00007ffb`517f603d     : 00000031`8c9fa660 00007ffb`518076f9 00000168`9ceec0b0 00007ffb`517f27d1 : libvips_42!g_object_set_valist+0x26c
00000031`8c9fa3d0 00007ffb`51768742     : 00000031`8c9fa660 00007ffb`51a3180c 00000000`00000000 00000000`00000000 : libvips_42!g_object_set+0x1d
00000031`8c9fa400 00007ffb`51a31462     : 00000000`00000001 00000000`00000002 00000000`00000001 00007ffb`517cc8e2 : libvips_42!vips_object_get_argument_priority+0x272
00000031`8c9fa430 00007ffb`51800fca     : 00000168`9ba80960 00007ffb`51800f70 00000031`8c9fa6a0 00000168`9b3915c0 : libvips_42!g_closure_invoke+0xa3
00000031`8c9fa4b0 00007ffb`51800345     : 00000031`8c9fa6c0 00007ffb`51800327 00000168`00000000 00000168`9ba80960 : libvips_42!g_clear_signal_handler+0x7b9
00000031`8c9fa5f0 00007ffb`517ffb22     : 00000168`00000000 00007ffb`517f448b 00000000`00000000 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x853
00000031`8c9fa7e0 00007ffb`5180064b     : 00000168`9b29c7c0 00000168`9ba80960 00000168`9b002fd0 00007ffb`528c2228 : libvips_42!g_signal_emit_valist+0x30
00000031`8c9fa830 00007ffb`5176b7d8     : 00000000`00000000 00007ffb`517f7d67 00000168`9b66cea0 00000168`9b002fd0 : libvips_42!g_signal_emit+0x19
00000031`8c9fa860 00007ffb`517f43c6     : 00000031`8c9fa928 00007ffb`5176b82f 00000168`00000000 00007ffb`51802650 : libvips_42!vips_object_get_description+0x5d8
00000031`8c9fa8c0 00007ffb`5176adbc     : 00000031`8c9faab0 00000000`00000000 00000000`00000060 00000000`00000000 : libvips_42!g_object_unref+0xcd
00000031`8c9fa930 00007ffb`51a31462     : 00000002`00000003 00000168`99190000 00000168`9b381560 00007ffb`517cc8e2 : libvips_42!vips_object_local_array+0xac
00000031`8c9fa970 00007ffb`51800fca     : 00000168`9b381560 00007ffb`51800f70 00000000`00000060 00000000`00000000 : libvips_42!g_closure_invoke+0xa3

SYMBOL_NAME:  ucrtbase!abort+4e

MODULE_NAME: ucrtbase

IMAGE_NAME:  ucrtbase.dll

STACK_COMMAND:  ~10s ; .cxr ; kb

FAILURE_BUCKET_ID:  FAIL_FAST_FATAL_APP_EXIT_c0000409_ucrtbase.dll!abort

OS_VERSION:  10.0.19041.1

BUILDLAB_STR:  vb_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

IMAGE_VERSION:  6.2.19041.789

FAILURE_ID_HASH:  {e31753ac-c98a-8055-3663-47e707543d20}

Followup:     MachineOwner
---------

@lovell
Copy link
Owner

lovell commented Mar 26, 2024

Thanks for the stack trace, the salient part is:

000000318c9f7f60 00007ffb51a31462 : 0000016899190000 000001689b1e9ed0 0000000000000017 00007ffb517cc8e2 : libvips_42!vips_jp2ksave_target+0x48f
...
000000318c9f84a0 00007ffb517f43c6 : 0000000000000000 0000000000000000 000000318c9f87d0 0000000000000000 : libvips_42!vips_openslideload_source+0x84c

It looks like you're using an OpenSlide image as input and JPEG-2000 as output (the default for OpenSlide input IIRC).

Neither of these formats are supported by the prebuilt binaries provided by sharp. Are you using the "all" variant from https://github.com/libvips/build-win64-mxe/releases/tag/v8.15.2 ? If so it's likely you've hit a problem in one of either the OpenSlide or OpenJPEG dependencies.

@kleisauke
Copy link
Contributor

I could not reproduce this using:

PS> node -e "require('sharp')('316545457-c739f442-d1ed-45d1-83d2-3566c2ba8f30.jpg', { failOn: 'error' }).resize(450, 253).toFile('x.jpg')"

000000318c9f7f60 00007ffb51a31462 : 0000016899190000 000001689b1e9ed0 0000000000000017 00007ffb517cc8e2 : libvips_42!vips_jp2ksave_target+0x48f
...
000000318c9f84a0 00007ffb517f43c6 : 0000000000000000 0000000000000000 000000318c9f87d0 0000000000000000 : libvips_42!vips_openslideload_source+0x84c

This may also indicate that the wrong PDB file has been loaded, you can verify this with:

0:000> !chksym libvips-42.dll

\\?\C:\Users\kleisauke\sharp-test\node_modules\@img\sharp-win32-x64\lib\libvips-42.dll
    Timestamp: 65F30D45
  SizeOfImage: 14B2000
          pdb: /var/tmp/tmp-vips-web-x86_64-w64-mingw32.static.posix.web/vips-8.15.2.build_/libvips/libvips-42.pdb
      pdb sig: 381B381D-4BA9-0BF8-4C4C-44205044422E
          age: 1

Loaded pdb is C:\ProgramData\Dbg\sym\libvips-42.pdb\381B381D4BA90BF84C4C44205044422E1\libvips-42.pdb

libvips-42.pdb
      pdb sig: 381B381D-4BA9-0BF8-4C4C-44205044422E
          age: 1

MATCH: libvips-42.pdb and \\?\C:\Users\kleisauke\sharp-test\node_modules\@img\sharp-win32-x64\lib\libvips-42.dll

@RyAndrew
Copy link
Author

Honestly I'm stabbing in the dark with this debugging process so any additional information is appreciated.

I don't believe I'm trying to save anything as jpeg2000 but that appears to be the function name implicated in this dump file.

Since this appears to be an issue with the upstream package my goal here would be to ensure I have the appropriate data to open an issue for them. Do you think there is anything additional to provide at this point?

To generate this stack trace I used these files:
pdb_8.15.2_vips-pdb-w64-web-8.15.2-static.zip
vips-dev-w64-web-8.15.2-static.zip

This looks like I've got the correct symbols loaded - I would expect windbg doesn't load them if there is a mismatch.

0:010> !chksym libvips-42.dll

libvips-42.dll
    Timestamp: 65F30D45
  SizeOfImage: 14B2000
          pdb: /var/tmp/tmp-vips-web-x86_64-w64-mingw32.static.posix.web/vips-8.15.2.build_/libvips/libvips-42.pdb
      pdb sig: 381B381D-4BA9-0BF8-4C4C-44205044422E
          age: 1

Loaded pdb is C:\ProgramData\dbg\sym\libvips-42.pdb\381B381D4BA90BF84C4C44205044422E1\libvips-42.pdb

libvips-42.pdb
      pdb sig: 381B381D-4BA9-0BF8-4C4C-44205044422E
          age: 1

MATCH: libvips-42.pdb and libvips-42.dll

@lovell
Copy link
Owner

lovell commented Mar 26, 2024

@RyAndrew Does your app replace/override any of the prebuilt libvips binaries provided by sharp? By default sharp does not support the formats mentioned in the stack trace, which leads me to believe you have. However if you are using the "stock" binaries provided by sharp then I guess we might be seeing the effects of possible stack corruption on function pointers.

Anything you can do to help narrow this down further, e.g. one image, one format, certain dimensions etc. would be helpful. Perhaps remove all networking logic and loop over files in a directory to see if you can still reproduce?

@RyAndrew
Copy link
Author

Everything is stock - I replaced the DLL's with the static versions to capture the stack trace only.
If I used the wrong version that was not my intention.

I'll try to produce a failure scenario with code - so far it has not been due to a specific file or anything like that. Your hint regarding specific dimensions is interesting - I'll test that as well.

@lovell
Copy link
Owner

lovell commented Apr 11, 2024

@RyAndrew Were you able to make any progress with this?

@lovell lovell added question and removed triage labels Apr 11, 2024
@lovell
Copy link
Owner

lovell commented Apr 29, 2024

Closing due to inactivity but please feel free to reopen with more details if further help is required.

@lovell lovell closed this as completed Apr 29, 2024
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

3 participants