Sharp randomly stalling when nesting sharp processes with composite
Hi, I've noticed that some kind of race condition seems to happen when composing an image with another sharp instance, like this:
let outer = sharp(....)
outer.composite([
await sharp(....)
.toBuffer()
])
await outer.toBuffer()
Please notice that the outer sharp instance is first instantiated but not finalized, and the inner sharp instance runs between instantiation and finalization.
This way, the process randomly stalls, having the nested promise to return (the inner image), but not the outer one. I'm using the latest 0.30.7 version of sharp, and node v18.8.0.
I've fixed this reliably by moving the inner image processing before instantiation, like this:
let inner = await sharp(....).toBuffer()
let outer = sharp(....)
outer.composite([
inner
])
await outer.toBuffer()
Is this bug known? Please let me know if I can help somehow.
Thanks
Please can you provide complete, standalone code that allows someone else to reproduce.
Closing due to inactivity but please feel free to reopen with the requested details if further help is required.