i/o timeout errors using mgo

2,251 views
Skip to first unread message

Jamison Dance

unread,
Oct 2, 2013, 1:24:28 PM10/2/13
to mgo-...@googlegroups.com
I am doing a long-running (several hours long) data import into Mongo using the newest mgo release (r2013.09.04), Go 1.1 and Mongo 2.2.

I am seeing intermittent i/o timeout errors.

We create the mongo connection first, and then do 20 or so minutes of work that doesn't use the connection at all. The import will then fail on the very first write to the connection, with the following error text:

`panic: read tcp 127.0.0.1:27017: i/o timeout`

Is there something we need to set to make the connection not timeout if we create it and aren't using it for a while?

Gustavo Niemeyer

unread,
Oct 2, 2013, 1:31:41 PM10/2/13
to mgo-...@googlegroups.com
Either Copy/Close a session for doing the work, or just Refresh
the session once you're done using it. This will put the underlying
socket back into the pool, and while in the pool these timeouts are
managed automatically, and your session will get a new socket if
that's necessary on the next time you use it.

If you need any extra details just let us know.
> --
> You received this message because you are subscribed to the Google Groups
> "mgo-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mgo-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--

gustavo @ http://niemeyer.net

LI Daobing

unread,
Oct 11, 2013, 5:10:07 AM10/11/13
to mgo-...@googlegroups.com
I tried copy session every time when I query data from mongodb, but I found that the connection count increase very quickly after I introduce this change.

And I need manage the session manually, which need a big refactor on my project.

how to disable this new "feature"?

Thanks

Robert Melton

unread,
Oct 11, 2013, 5:20:12 AM10/11/13
to mgo-...@googlegroups.com
You are closing them after you copy them right?
Robert Melton | Contact Information @ http://robertmelton.com
“Go(lang) doesn't implicitly anything.”
Reply all
Reply to author
Forward
0 new messages