packetmonkey / prawn-gmagick

Use GraphcisMagick to load images into a Prawn document
https://github.com/packetmonkey/prawn-gmagick/
13 stars 6 forks source link

LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) NULL' failed. #16

Open Griffin38 opened 5 years ago

Griffin38 commented 5 years ago

While running a ruby worker(BagAndAddressLabelWorker) which prints a large amount of labels this error happens which then crashes the whole process , after some investigation i came across this link which might beexplain how it is related to prawm-gmagick and how it uses gmagick.

this happened on heroku, never happened while being run locally

`2018-11-27T15:08:43.412089+00:00 app[worker.1]: 2018-11-27T15:08:43.411Z 4 TID-auuvo BagAndAddressLabelWorker JID-1d01611f7497eb8ee98b8544 INFO: start

2018-11-27T15:08:46.330344+00:00 heroku[worker.1]: State changed from up to crashed

2018-11-27T15:08:46.161001+00:00 app[worker.1]: sidekiq 3.3.0 app [5 of 5 busy]: magick/semaphore.c:601: LockSemaphoreInfo: Assertion semaphore_info != (SemaphoreInfo *) NULL' failed.

2018-11-27T15:08:46.161145+00:00 app[worker.1]: Magick: abort due to signal 6 (SIGABRT) "Abort"...

2018-11-27T15:08:46.407180+00:00 heroku[worker.1]: State changed from crashed to starting

2018-11-27T15:08:46.308948+00:00 heroku[worker.1]: Process exited with status 134

2018-11-27T15:08:47.814764+00:00 app[worker.2]: 2018-11-27T15:08:47.814Z 4 TID-11qgzg BagAndAddressLabelWorker JID-5e049441852fee6847feca85 INFO: done: 22.052 sec`

packetmonkey commented 5 years ago

@Griffin38 hi, thanks for the issue. I don't use this library much anymore but this is an interesting error, I too used it inside a sidekiq worker on heroku for a while and didn't run into this issue.

Assuming your link is the correct source of the issue, you could try removing the various InitializeMagick calls in image.c and try placing a single call at the top of Init_image to see of that does successfully resolve your issue.

In case it's also relevant, the version of graphics magic I was using that didn't show this problem was 1.3.21

If you do manage to reproduce this issue locally with a script, please share it, I may be able to take some time and try to sort out a fix as well.