pygments / pygments.rb

💎 Ruby wrapper for Pygments syntax highlighter
MIT License
572 stars 141 forks source link

EPIPE pygments.rb (0.5.4) lib/pygments/popen.rb:261:in `rescue in mentos' #97

Closed 9mm closed 3 years ago

9mm commented 10 years ago

Hi,

This has been something that's happened on my site since I started using pygments.rb a long time ago. It seemed to be less prominent before and I could deal with it as long as I occassionally 'pinged' my server with curl on a cron job, but now that I updated, it's happening many times per day and people can't read my blog articles that have syntax highlighting in them (they get 500 error).

After they visit the page and it 500's you can refresh and it magically will work for about 5 minutes on any article you go to. Then it starts 500'ing again. My curl trick no longer works it seems, as I get exception notifications all day long.

An ActionView::Template::Error occurred in discussions#show:

 EPIPE
 pygments.rb (0.5.4) lib/pygments/popen.rb:261:in `rescue in mentos'

and

-------------------------------
Backtrace:
-------------------------------

 pygments.rb (0.5.4) lib/pygments/popen.rb:261:in `rescue in mentos'
 pygments.rb (0.5.4) lib/pygments/popen.rb:213:in `mentos'
 pygments.rb (0.5.4) lib/pygments/popen.rb:202:in `highlight'
 lib/pineapple_markdown_renderer.rb:11:in `block_code'
 lib/pineapple_markdown.rb:22:in `render'
 lib/pineapple_markdown.rb:22:in `to_html'
 app/helpers/comments_helper.rb:3:in `markdown'
 app/views/discussion_comments/_comment.html.erb:10:in `block in _app_views_discussion_comments__comment_html_erb__3322690692533492810_295911540'
 actionpack (3.2.15) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
 actionpack (3.2.15) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
 actionpack (3.2.15) lib/action_view/helpers/capture_helper.rb:40:in `capture'
 actionpack (3.2.15) lib/action_view/helpers/record_tag_helper.rb:104:in `content_tag_for_single_record'
 actionpack (3.2.15) lib/action_view/helpers/record_tag_helper.rb:89:in `content_tag_for'
 actionpack (3.2.15) lib/action_view/helpers/record_tag_helper.rb:34:in `div_for'
 app/views/discussion_comments/_comment.html.erb:9:in `_app_views_discussion_comments__comment_html_erb__3322690692533492810_295911540'
 actionpack (3.2.15) lib/action_view/template.rb:145:in `block in render'
 activesupport (3.2.15) lib/active_support/notifications.rb:125:in `instrument'
 actionpack (3.2.15) lib/action_view/template.rb:143:in `render'
 actionpack (3.2.15) lib/action_view/renderer/partial_renderer.rb:351:in `block in collection_with_template'
 actionpack (3.2.15) lib/action_view/renderer/partial_renderer.rb:348:in `each'
 actionpack (3.2.15) lib/action_view/renderer/partial_renderer.rb:348:in `collection_with_template'
 actionpack (3.2.15) lib/action_view/renderer/partial_renderer.rb:250:in `render_collection'
 actionpack (3.2.15) lib/action_view/renderer/partial_renderer.rb:234:in `block in render'
 actionpack (3.2.15) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'

Any idea how i can debug/remedy this?

damian-sowers commented 10 years ago

I'm having a similar strange problem. It seems as if Pygments.rb is crashing my platform at random times. Get the following error: Resource temporarily unavailable - posix_spawnp

I'm thinking it might be related to the version of python that RubyPython is loading? Any ideas anyone?

slonopotamus commented 3 years ago

Inter-process communication and timeout handling was severely reworked in #209, please retest.

9mm commented 3 years ago

@slonopotamus lol, this 8 year old code is long gone and dead, but thanks for fixing!