Skip to content

Fix manualy client destroy#32

Open
moisespsena wants to merge 50 commits intoLytol:masterfrom
moisespsena:fix-manualy-client-destroy
Open

Fix manualy client destroy#32
moisespsena wants to merge 50 commits intoLytol:masterfrom
moisespsena:fix-manualy-client-destroy

Conversation

@moisespsena
Copy link

When I run the Mongo.destroy command to close the connection manually,
it is closed as expected. But end of the program,
Julia will call the handler finalizer which will try to close the connection.
When the finalizer is called, the connection has been closed. At this time,
called mongoc_client_destroy will release the error "segmentation fault".

To solve, I implemented the MongoClient._closed attribute and when Mongo.destroy
is invoked, the function will check the value of the attribute. If you have false
calls mongoc_client_destroy and changes the value of _closed to true.
When Julia called finalizer, the mongoc_client_destroy will not be called again.

Adrian Lanzafame and others added 20 commits July 21, 2015 15:58
Added client connection with user auth and db options
Fixed missing base overrides - I think there was a failing 0.4 test before anyway
that refers to prereleases of julia 0.3 and has not been necessary for a year
remove - on julia version in REQUIRE
fix Dict syntax in readme for 0.4, fix import warning
New query syntax with operators and modifiers
When I run the "Mongo.destroy" command to close the connection manually,
it is closed as expected. But end of the program,
Julia will call the handler "finalizer" which will try to close the connection.
When the "finalizer" is called, the connection has been closed. At this time,
called "mongoc_client_destroy" will release the error "segmentation fault".

To solve, I implemented the MongoClient._closed attribute and when "Mongo.destroy"
is invoked, the function will check the value of the attribute. If you have "false"
calls "mongoc_client_destroy" and changes the value of "_closed" to "true".
When Julia called "finalizer", the "mongoc_client_destroy" will not be called again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants