[mongodb-user] Perl Driver 0.32 - "recv timed out"

307 views
Skip to first unread message

Sam

unread,
May 4, 2010, 1:08:58 PM5/4/10
to mongodb-user
Hi all,

Upgraded to MongoDB 1.4.1 with Perl Driver 0.32 yesterday, and
perl processes crashed with messages:

"recv timed out at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-
thread-multi/MongoDB/Connection.pm line 386"

"recv timed out at /home/health/bin/alert_layer.pl line 308"
line 308 of alert_layer is just a simple query:
my $cursor = $collection{statsfields}->query({ 'cumulative' => '1' });

Is there a new timeout that is being enforced that would cause
this? How would I extend this or turn it off? Thanks.

Sam

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Kristina Chodorow

unread,
May 4, 2010, 2:07:08 PM5/4/10
to mongod...@googlegroups.com

Sam

unread,
May 4, 2010, 2:09:18 PM5/4/10
to mongodb-user
The plot thickens...

There looks to be a timeout parameter of 30 seconds on queries
($MongoDB::Cursor::timeout = 30000;). However, looking at the mongo
log around the time the only query that was above 30 seconds was *from
the php driver* !!!!

Tue May 4 07:20:49 query Health.CudaStats ntoreturn:1 reslen:990
nscanned:82257 { $where: "this.model == 880 && this.model_full !=
null" } nreturned:1 32895ms

That particular query is only called from php... why in the world
would the slowness of a query from php trigger the timeout in our perl
scripts?

Weird, huh? =)

Sam

unread,
May 4, 2010, 7:07:56 PM5/4/10
to mongodb-user
Hi Kristina,

Ok, so I think we've figured out what causes the timeouts (another
one just happened):

Application Log:
[20100504 14:49:44] Inserted: 1893, Duplicates: 1, Errors: 3
recv timed out at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-
thread-multi/MongoDB/Connection.pm line 386.

Mongo Log:
Tue May 4 14:50:13 allocating new datafile /data/db/Health.6, filling
with zeroes...
Tue May 4 14:50:46 done allocating datafile /data/db/Health.6, size:
2047MB, took 32.865 secs
Tue May 4 14:50:46 insert Health.CudaStats 32996ms

So it looks like allocating the new datafile is causing the perl
insert to block, and since it took over 32 seconds to allocate the
datafile, the perl driver crashed.

Rather than just increase the timeout, is it possible to set a
flag or something that changes this behavior? We would like to be
notified that the MongoDB query/insert/update took over $timeout
seconds, but the perl scripts can't just die like they're doing now.
Thanks in advance for looking into this.

Sam

On May 4, 11:07 am, Kristina Chodorow <krist...@10gen.com> wrote:
> Seehttp://search.cpan.org/dist/MongoDB/lib/MongoDB/Cursor.pm#timeout.
>
>
>
> On Tue, May 4, 2010 at 1:08 PM, Sam <lovable...@gmail.com> wrote:
> > Hi all,
>
> >    Upgraded to MongoDB 1.4.1 with Perl Driver 0.32 yesterday, and
> > perl processes crashed with messages:
>
> > "recv timed out at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-
> > thread-multi/MongoDB/Connection.pm line 386"
>
> > "recv timed out at /home/health/bin/alert_layer.pl line 308"
> > line 308 of alert_layer is just a simple query:
> > my $cursor = $collection{statsfields}->query({ 'cumulative' => '1' });
>
> >    Is there a new timeout that is being enforced that would cause
> > this?  How would I extend this or turn it off?  Thanks.
>
> > Sam
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.

Kristina Chodorow

unread,
May 4, 2010, 7:29:47 PM5/4/10
to mongod...@googlegroups.com
Cool, that makes a lot more sense than PHP driver contamination!  

You can catch the die with an eval{}, and that's behavior is not going to change in the near future.  Originally, I had the driver die when a request failed.  Then someone said that the Perl-ier way would be to have it return 0, so the next version did that.  Then someone said that it should die, so, I solicited a ton of opinions and everyone said it should die, so I changed it back.  So, sorry you missed the vote, but now we're stuck with die :-/

Sam

unread,
May 5, 2010, 12:00:30 PM5/5/10
to mongodb-user
Understood, thanks for the quick replies! By the way, the PHP thing
is most likely because the PHP query blocked the database for over 30
seconds, which of course would cause the timeout on the Perl driver
side.

Sam
> > <mongodb-user%2Bunsu...@googlegroups.com<mongodb-user%252Buns...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages