Git Product home page Git Product logo

Comments (7)

iconara avatar iconara commented on July 18, 2024

This became a real issue in JRuby 9K. I'm using Fishwife with Grape, and it rewinds the request body for some reason, and that raises an Errno::EPIPE. I'm not really sure why this doesn't happen in JRuby 1.7, but the IO has been thoroughly rewritten in 9K so everything works differently.

from fishwife.

iconara avatar iconara commented on July 18, 2024

I found the same problem in the last Travis run of Fishwife, so you probably already know what I'm talking about: https://travis-ci.org/dekellum/fishwife/jobs/48211628#L446

from fishwife.

dekellum avatar dekellum commented on July 18, 2024

Thanks for pointing this out @iconara, as I hadn't investigated the specifics of the jruby 9.x travis failure. I'd like to see a clean implementation of input rewind in Fishwife. Happen to know if there is a suitable open source implementation existing that could be leveraged? I'm not sure when I will get the time to write one from scratch.

from fishwife.

iconara avatar iconara commented on July 18, 2024

I can't say that I do, but I will investigate too. We've tried just about all (J)Ruby Rack servers now and Fishwife is the only one that we haven't yet found any horrible faults with. We're not looking to move to 9K anytime soon, I think a stable version is months into the future, but once we do we will solve this problem one way or the other.

I looked at the suggested fix in Mizuno, but I think it's too complex. I don't have the full grasp of the problem yet so I probably shouldn't make too many judgements, though. From my perspective an upload is either small or big. Small as in it's no problem to gobble it into an in-memory buffer, and big as in we need to buffer it on disk, but that may be too simplistic.

I'm also considering throwing out all Rack frameworks that try to rewind the request body, since it means they read it, and that feels like a pretty stupid thing for a framework to do. It's not hard to OOM an application that behaves that way.

from fishwife.

dekellum avatar dekellum commented on July 18, 2024

Regarding the JRuby 9.x travis failure and @iconara 's question on how this "worked" on JRuby 1.7.x—earlier JRubies InputStream#to_io return an IO objects that responds to rewind. Unfortunately this rewind is a No-Op. JRuby is masking the lack of rewind support and keeping Rack::Lint (used in the tests) happy where it shouldn't be.

In JRuby 9.x, apparently the object no long responds to rewind and instead raises Errno::ESPIPE, which is correct.

from fishwife.

dekellum avatar dekellum commented on July 18, 2024

Rewind support for request bodies is now implemented in the fishwife 1.7.0 release. See the request_body_* configuration options of Fishwife::HttpServer.new.

from fishwife.

iconara avatar iconara commented on July 18, 2024

That's great, and :request_body_max was a nice extra addition that will make it possible for me to throw away some code. Thank you!

from fishwife.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.