defunkt/resque — Issue #488: Workers randomly stick
Author: gitt
Created: 2012-01-08 10:23:52+00:00
State: open

I'm not entirely sure this is a resque issue, but at this point I believe I've exhausted all other leads.

I've got an image processing application, this uses [carrierwave](https://github.com/jnicklas/carrierwave), [carrierwave backgrounder](https://github.com/lardawge/carrierwave_backgrounder), and resque.

The user uploads a photo, we put the data into a tmp directory on the server, and pass it to resque to have the processing done, and have it pushed to s3. The original test data was comprised of JPG files around 1MB in size. However, the actual usage will involve much larger file ( 5+ MB). We began testing with these this week.

Now, on to the issue at hand...

The smaller (1MB) files process no issue, everything is great. However, when we upload larger files, one or more workers will hit 100% CPU usage, never actually process a file, never transfer any data, and not throw an error. The worker will just sit in this state until manually killed.

This actually happens at random. Take the following example:

Workers:
resque-0
resque-2
resque-3
resque-4

IMG_1.JPG - 4MB
IMG_2.JPG - 7MB
IMG_3.JPG - 5MB
IMG_4.JPG - 3MB
IMG_5.JPG - 5MB

The files are uploaded, a record is added to the database, a job is added to redis, and workers quickly pickup.

resque-0 picks up on IMG_1.JPG
resque-1 picks up on IMG_2.JPG
resque-2 picks up on IMG_3.JPG
resque-3 picks up on IMG_4.JPG
resque-4 picks up on IMG_5.JPG

```
Run #1:
resque-1..4 finish, and upload the photos to s3, resque-0 sits @ 100% CPU, the file versions are never created, nor anything pushed to s3.
```

```
Run #2
resque-0, 1, 2, and 4 finish, and upload the photos to s3, resque-3 sits @ 100% CPU, the file versions are never created, nor anything pushed to s3.
```

```
Run #3
resque-0, 1 , 3, and 4 finish, and upload the photos to s3, resque-2 sits @ 100% CPU, the file versions are never created, nor anything pushed to s3.
```

As you can see above, the worker just sits there, the image itself, nor the record data (that I can find) is tied to why it never finishes, and I cannot seem to get much debugging data from resque itself on what exactly the worker is doing.

I apologize for the long read, but I wanted to be as detailed as possible. Any help is greatly appreciated in debugging this issue.