Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-12622: [Python] Fix segfault in read_csv when not on main thread #10227

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/pyarrow/error.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ cdef class SignalStopHandler:
if signal.getsignal(sig) not in (signal.SIG_DFL,
signal.SIG_IGN, None)]

self._stop_token = StopToken()
if not self._signals.empty():
self._stop_token = StopToken()
self._stop_token.init(GetResultValue(
SetSignalStopSource()).token())
self._enabled = True
Expand Down
8 changes: 8 additions & 0 deletions python/pyarrow/tests/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,14 @@ def signal_from_thread():
assert isinstance(e, pa.ArrowCancelled)
assert e.signum == signal.SIGINT

def test_cancellation_disabled(self):
# ARROW-12622: reader would segfault when the cancelling signal
# handler was not enabled (e.g. if disabled, or if not on the
# main thread)
t = threading.Thread(target=lambda: self.read_bytes(b"f64\n0.1"))
t.start()
t.join()


class TestSerialCSVRead(BaseTestCSVRead, unittest.TestCase):

Expand Down