rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

Segmentation fault (core dumped) error when defining second parameter in asset block #128

Closed codelitt closed 10 years ago

codelitt commented 11 years ago

I was getting an Segmentation fault (core dumped) and SystemStackError stack level too deep whenever I run my Sinatra app and try to load the index page. It immediately shuts down the app server (Thin).

I isolated the error and figured out that there is a conflict if you try to define the second parameter in the asset block that would normally tell your app where the assets will be served.

Here are the full details: http://stackoverflow.com/questions/17933818/segmentation-fault-core-dumped-error-in-sinatra-app

I listed the full debug errors in that link on StackOverflow but am not sure where in the gem exactly the conflict is occurring or how to fix it BUT my fix is super simple. Just remove the second param so it looks more like:

css :app, [

'/css/bootstrap.css', # bootstrap.less

'/css/.css', '/css/.min.css' ]

js :app, [ '/js/*.js' ]

j15e commented 10 years ago

Thanks for reporting, I was able to replicate this issue in an other project and it is related to the use of rack sessions internally. If you name your package as the name of one the files in the package, it causes a loop of request and then a crash.

See #68 for more details, which is pending a fix but requires lot of changes.

This will be fix when we fix #68.

For now, just remove package name as you did or use an other package name (ex. "/css/bootstrap.min.css").