
### ImageMagick version

6.9.10.97

### Operating system

Linux

### Operating system, version and so on

Amazon Linux 2

### Description

I am facing Segmentation fault when multiple images are being resized using `gm` npm module v1.25.0 which internally uses `ImageMagick` module.

Following is the stack trace coming from [segfault-handler](https://www.npmjs.com/package/segfault-handler) logs:

    PID 28586 received SIGSEGV for address: 0x8 
    {file_path}/segfault-handler.node(+0x2f30)[0xffffa82e1f30]
    linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffffaa6ac860]
    (_ZN2v86Object3SetENS_5LocalINS_7ContextEEENS1_INS_5ValueEEES5_+0x1c)[0xb80054]
    [0xacbf44]
    [0xbdca54]
    [0xbddb18]
    (_ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE+0x20)[0xbde198]
    [0x137b56c]

Here is the kernel version on which we are observing this issue:

    ['kernel', '5.10.199-190.747.amzn2'],
    ['kernel-devel', '5.10.199-190.747.amzn2'],
    ['kernel-headers', '5.10.199-190.747.amzn2'],
    ['kernel-tools', '5.10.199-190.747.amzn2']


### Steps to Reproduce

    var  gm  =  require('gm').subClass({ imageMagick:  true });
    
    // Usage in API like this
    axios({
        url: imageSrc,
        responseType: 'stream'
      }).then((res) => {
        gm(res.data)
          .resize('186', '254', '!') // ignore aspect ratio like 'fill ' in sharp module
          .compress('JPEG')
          .quality(60)
          .stream(function (err, stdout) {
            if (err) {
              // handle error
            }
            // pipe to res stream
          });
      }).catch((e) => {
        // handle error
      });

I have written a resizeImage API like this and this issue occurs when this API is called multiple times in parallel at once. This issue occurs with above mentioned npm version of gm and above mentioned version of kernel. This seems to `ImageMagick` issue as `gm` npm module doesn't interact with kernel level functionality.

### Images

_No response_
Segmentation fault with `gm` npm module and specific kernel of aws machine
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Segmentation fault with `gm` npm module and specific kernel of aws machine
Issue date:

--- start body ---

### ImageMagick version

6.9.10.97

### Operating system

Linux

### Operating system, version and so on

Amazon Linux 2

### Description

I am facing Segmentation fault when multiple images are being resized using `gm` npm module v1.25.0 which internally uses `ImageMagick` module.

Following is the stack trace coming from [segfault-handler](https://www.npmjs.com/package/segfault-handler) logs:

    PID 28586 received SIGSEGV for address: 0x8 
    {file_path}/segfault-handler.node(+0x2f30)[0xffffa82e1f30]
    linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffffaa6ac860]
    (_ZN2v86Object3SetENS_5LocalINS_7ContextEEENS1_INS_5ValueEEES5_+0x1c)[0xb80054]
    [0xacbf44]
    [0xbdca54]
    [0xbddb18]
    (_ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE+0x20)[0xbde198]
    [0x137b56c]

Here is the kernel version on which we are observing this issue:

    ['kernel', '5.10.199-190.747.amzn2'],
    ['kernel-devel', '5.10.199-190.747.amzn2'],
    ['kernel-headers', '5.10.199-190.747.amzn2'],
    ['kernel-tools', '5.10.199-190.747.amzn2']


### Steps to Reproduce

    var  gm  =  require('gm').subClass({ imageMagick:  true });
    
    // Usage in API like this
    axios({
        url: imageSrc,
        responseType: 'stream'
      }).then((res) => {
        gm(res.data)
          .resize('186', '254', '!') // ignore aspect ratio like 'fill ' in sharp module
          .compress('JPEG')
          .quality(60)
          .stream(function (err, stdout) {
            if (err) {
              // handle error
            }
            // pipe to res stream
          });
      }).catch((e) => {
        // handle error
      });

I have written a resizeImage API like this and this issue occurs when this API is called multiple times in parallel at once. This issue occurs with above mentioned npm version of gm and above mentioned version of kernel. This seems to `ImageMagick` issue as `gm` npm module doesn't interact with kernel level functionality.

### Images

_No response_
--- end body ---
