Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crashes when Response pipe is broken #373

Closed
carlosmiranda opened this issue Jul 27, 2015 · 21 comments
Closed

Application crashes when Response pipe is broken #373

carlosmiranda opened this issue Jul 27, 2015 · 21 comments

Comments

@carlosmiranda
Copy link

I am trying to write a small monitoring application using Takes. Right now I'm having issues, because the application keeps crashing with the following error printed to the output:

Exception in thread "main" java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:297)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
        at org.takes.rs.RsPrint.printHead(RsPrint.java:148)
        at org.takes.rs.RsPrint.print(RsPrint.java:110)
        at org.takes.http.BkBasic.print(BkBasic.java:104)
        at org.takes.http.BkBasic.accept(BkBasic.java:77)
        at org.takes.http.FtBasic.loop(FtBasic.java:105)
        at org.takes.http.FtBasic.start(FtBasic.java:91)
        at com.adecco.sam.util.aspire.CheckAvailability.main(CheckAvailability.java:119)

Line 119 is a call to FtBasic.start(). I don't think the application should crash when the response tries to write to the output, which means either this is definitely a bug or I'm doing something wrong.

UPDATE: Upon further investigation, it appears that the solution to this is to wrap the Take into a BkSafe before sending it to FtBasic. This is what FtCLI does. However, there's no clear documentation on how to use BkSafe or Back, which is confusing to people who are building applications using this framework.

Thus, I propose a couple of things:

  1. Document Back usage in README
  2. Use BkSafe by default when using FtBasic, or provide an implementation FtSafe which does this and use it in the README examples.

This way developers won't be wondering why their app keeps crashing when the response pipe gets disconnected...

@yegor256
Copy link
Owner

@carlosmiranda makes sense, thanks!

@yegor256 yegor256 added the bug label Jul 27, 2015
@davvd
Copy link

davvd commented Jul 27, 2015

@carlosmiranda this task will get someone's attention soon

@davvd davvd added this to the 1.0 milestone Jul 27, 2015
@davvd
Copy link

davvd commented Jul 27, 2015

@carlosmiranda since there is no milestone yet I set it to "1.0"

@davvd
Copy link

davvd commented Jul 27, 2015

@carlosmiranda thank you for the ticket reported, I topped your account for 15 mins, transaction 61755338

@carlosmiranda
Copy link
Author

@yegor256 just a side note... I like the way that I'm actually able to use our open-source projects during my day job. :)

@yegor256
Copy link
Owner

@carlosmiranda that's what they are for :) and I'm sure you're not alone

@davvd
Copy link

davvd commented Aug 27, 2015

@adko-pl this task is for you, keep these principles in mind, and don't hesitate to ask any technical questions... The budget here is 30 mins, which is exactly how much time will be paid for, when the task is completed

@davvd davvd added the @adko-pl label Aug 27, 2015
@yegor256
Copy link
Owner

@0crat in

@0crat
Copy link
Collaborator

0crat commented Aug 14, 2017

@0crat in (here)

@yegor256 Job gh:yegor256/takes#373 is in scope.

@0crat
Copy link
Collaborator

0crat commented Aug 14, 2017

Job gh:yegor256/takes#373 assigned to @caarlos0, please go ahead (policy).

@0crat
Copy link
Collaborator

0crat commented Nov 16, 2017

@caarlos0 this job was assigned to you 8 days ago.
It will be taken away from you after 10 days from start (this is our policy).

@0crat
Copy link
Collaborator

0crat commented Nov 16, 2017

Oops! Job gh:yegor256/takes#373 is not assigned to anyone.

2 similar comments
@0crat
Copy link
Collaborator

0crat commented Nov 16, 2017

Oops! Job gh:yegor256/takes#373 is not assigned to anyone.

@0crat
Copy link
Collaborator

0crat commented Nov 16, 2017

Oops! Job gh:yegor256/takes#373 is not assigned to anyone.

@0crat
Copy link
Collaborator

0crat commented Jan 24, 2018

The job #373 assigned to @t-izbassar/z. The budget is 30 minutes, see §4. Please, read §8 and §9. If the task is not clear, read this and this.

t-izbassar pushed a commit to t-izbassar/takes that referenced this issue Jan 25, 2018
t-izbassar pushed a commit to t-izbassar/takes that referenced this issue Jan 26, 2018
t-izbassar pushed a commit to t-izbassar/takes that referenced this issue Jan 26, 2018
@t-izbassar
Copy link
Contributor

@0crat waiting for #776

@0crat
Copy link
Collaborator

0crat commented Jan 26, 2018

@0crat waiting for #776 (here)

@t-izbassar The impediment for #373 was registered successfully by @t-izbassar/z

@t-izbassar
Copy link
Contributor

@carlosmiranda can you close this one? PR #776 was merged.

@carlosmiranda
Copy link
Author

@t-izbassar thanks!

@0crat
Copy link
Collaborator

0crat commented Jan 29, 2018

Order was successfully finished: +30 points just awarded to @t-izbassar/z, total is +60

@0crat
Copy link
Collaborator

0crat commented Jan 29, 2018

The job #373 is now out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants