FAQ
I am trying to figure out why a program of mine has been hanging for hours.
This is the first time this is happening, after it has run for months
without problems, so this is a problem that is hard to reproduce.

The programs uses http.NewRequest() from net/http, it sets a transport
with ResponseHeaderTimeout: 90 * time.Second, it calls run, and if that
succeeds, it starts reading lines from the response body until an error
occurs (including EOF), then it closes the response body, waits a bit, and
starts over.

If requests fail many times in a row, I get an error messages. I didn't get
that. It seems that something is hanging. What can that be? The Run() on
the request can't be it, with the timeout set, right? Can a read from the
response body hang? Or closing the response body?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • James Bardin at Sep 10, 2014 at 7:48 pm
    Sure it can, the server can just stop sending data. If you didn't get that
    far, Dial can hang too without a timeout on the Transport.Dial.
    What Run() method are you referring to? (there's none in the http package)

    If you can enforce some maximum total request time, set http.Client.Timeout.
    On Wednesday, September 10, 2014 3:36:19 PM UTC-4, Peter Kleiweg wrote:

    I am trying to figure out why a program of mine has been hanging for
    hours. This is the first time this is happening, after it has run for
    months without problems, so this is a problem that is hard to reproduce.

    The programs uses http.NewRequest() from net/http, it sets a transport
    with ResponseHeaderTimeout: 90 * time.Second, it calls run, and if that
    succeeds, it starts reading lines from the response body until an error
    occurs (including EOF), then it closes the response body, waits a bit, and
    starts over.

    If requests fail many times in a row, I get an error messages. I didn't
    get that. It seems that something is hanging. What can that be? The Run()
    on the request can't be it, with the timeout set, right? Can a read from
    the response body hang? Or closing the response body?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 10, '14 at 7:36p
activeSep 10, '14 at 7:48p
posts2
users2
websitegolang.org

2 users in discussion

James Bardin: 1 post Peter Kleiweg: 1 post

People

Translate

site design / logo © 2022 Grokbase