Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

test case for https://rt.cpan.org/Ticket/Display.html?id=63955 #13

Closed
wants to merge 11 commits into from
Closed

Conversation

leejo
Copy link

@leejo leejo commented Mar 20, 2011

appears to be a bug when calling find_one after an auto_reconnect has taken place. added a test case to catch this. cheers, lee.

Lee Johnson added 10 commits March 18, 2011 16:15
… might not find the master and thus udpates to be a slave, which will bomb out on the next test which tries to insert
… after reconnect whereas find works without problem
perl_mongo_master takes a flag to reconnect, but this was never
being set so the auto_reconnect flag was useless. fix this and
add tests (+ reorder tests slightly).

there is a (perhaps low level) bug somewhere, as can be seen in
the strace.out file included in this commit. when calling
perl_mongo_master we check if connected by first inspecting
link->master->connected, and then calling getpeername to check the
socket. in the strace.out we can see the following, which ties up
to the failing test in auto_reconnect.t:

getpeername(4, {sa_family=AF_INET, sin_port=htons(27272), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
sendto(4, "D\0\0\0\345\321\t\0\0\0\0\0\324\7\0\0\0\0\0\0test_database.foo\0\0\0\0\0\0\0\0\0\26\0\0\0\7_id\0M\216M\272\316\203xt'\0\0\2\0", 68, 0, NULL, 0) = 68
getpeername(4, 0x7fff47164990, [16])    = -1 ENOTCONN (Transport endpoint is not connected)
@csirac2
Copy link

csirac2 commented Oct 5, 2011

Nice work. Hope I can write a test that's even half as useful for https://jira.mongodb.org/browse/PERL-149 :)

@leejo
Copy link
Author

leejo commented Oct 5, 2011

On 5 Oct 2011, at 02:11, Paul.W Harvey wrote:

Nice work. Hope I can write a test that's even half as useful for
https://jira.mongodb.org/browse/PERL-149 :)

I'd forgotten about this! Don't think it has been pulled so it will
need testing with the latest version of the driver and server (i
haven't had time to test v2.0 yet).

Lee.

@edaniels
Copy link
Contributor

Hey @leejo! Currently we can't use your changes due to changes in some of the modules in the last 2 or so years. The auto_reconnect issue will be solved down the road but you are welcome to still get this fix in earlier than that. If you are still willing to modify your code to fit with the newer code, you are more than welcome to :). I've created a test in devel/t-dynamic called PERL-234-auto-reconnect.t that you can use to test whether or not this bug is fixed. It might need to be changed depending on the implementation of the fix.

@leejo
Copy link
Author

leejo commented Jul 23, 2014

Hi! Well it's been a while since i made this PR and i am no longer actively using mongodb. I can look at this if necessary, but will need to refresh my memory (and dev environment). It's been so long that if the issue is going to be resolved soon enough then it may be easier to just close this PR without merging.

I notice that this PR isn't very clean anyway, i could do with squashing it a bit and also removing some unnecessary files (don't know why i committed that strace output!)

@edaniels
Copy link
Contributor

Going to close this for now then. Thank you so much for the tests though. I didn't have to do much work to get them working with our current orchestration framework.

@edaniels edaniels closed this Jul 23, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants