[
https://issues.apache.org/jira/browse/TINKERPOP-1581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15736439#comment-15736439
]
ASF GitHub Bot commented on TINKERPOP-1581:
-------------------------------------------
GitHub user davebshow opened a pull request:
https://github.com/apache/tinkerpop/pull/515
TINKERPOP-1581 Gremlin-Python driver connection is not thread safe.
https://issues.apache.org/jira/browse/TINKERPOP-1581
This was a simple fix. The `DriverRemoteConnection.__init__` method no
longer ignores the `loop` kwarg passed by user. I added two tests using threads
as well. One demonstrates how not passing an `IOLoop`, which was in effect the
behavior before this PR, will cause a `RuntimeError`. The other shows how you
can now pass an `IOLoop` for each thread to avoid this problem.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1581
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/515.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #515
----
commit 2f3386daed8323b77aa48ed92335f353d09d06c1
Author: davebshow <[email protected]>
Date: 2016-12-09T21:40:53Z
allow user to pass loop to DriverRemoteConnection. added multi-threaded
tests.
----
> Gremlin-Python driver connection is not thread safe.
> ----------------------------------------------------
>
> Key: TINKERPOP-1581
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1581
> Project: TinkerPop
> Issue Type: Bug
> Components: language-variant
> Affects Versions: 3.2.3
> Reporter: Marko A. Rodriguez
> Fix For: 3.2.4
>
>
> From Dave on the mailing list.
> gremlin-python should work fine with threads, but there is a bug in the
> current code that makes it ignore the 'loop' parameter when it's there (and
> puts all calls on the same loop when it isn't, leading to crashes when
> running many threads):
> At line 43 in driver_remote_connection.py (function `DriverRemoteConnection`):
> {code}
> if loop is None:
> self._loop = ioloop.IOLoop.current()
> {code}
> should be:
> {code}
> if loop is None:
> self._loop = ioloop.IOLoop.current()
> else:
> self._loop = loop
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)