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

GH-15054: [Python] Finalize S3 on pytest exit to prevent shutdown crashes #33793

Conversation

westonpace
Copy link
Member

@westonpace westonpace commented Jan 19, 2023

For some reason destroying an S3Client at shutdown can cause a crash in our tests. It appears to be because S3's logging is already shut down. I wouldn't think this would happen because I would think the linker would tear down S3 shared libraries AFTER it tears down Arrow shared libraries.

However, we can also finalize S3 in conftest.py to prevent this crash.

It would still be good to understand the root cause. Otherwise we need to advise our users to call finalize_s3.

@westonpace westonpace requested a review from AlenkaF as a code owner January 19, 2023 18:06
@github-actions
Copy link

@github-actions
Copy link

⚠️ GitHub issue #15054 has been automatically assigned in GitHub to PR creator.

@lidavidm
Copy link
Member

because I would think the linker would tear down S3 shared libraries AFTER it tears down Arrow shared libraries.

In a wheel though, we statically link everything, and then destruction order is undefined as usual?

@@ -265,3 +265,13 @@ def add_fs(doctest_namespace, request, tmp_path):
doctest_namespace["local_path"] = str(tmp_path)
doctest_namespace["path"] = str(path)
yield

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the linter error is only because it expects two empty lines here.

Suggested change

@westonpace
Copy link
Member Author

In a wheel though, we statically link everything, and then destruction order is undefined as usual?

Yes, I think that could explain it. Still, this fix would require pyarrow users to know about and remember calling the finalize S3 method. I'm going to pause this idea and make an attempt at an arrow::Shutdown.

@westonpace westonpace marked this pull request as draft January 23, 2023 16:38
@westonpace
Copy link
Member Author

Closing in favor of #33858

@westonpace westonpace closed this Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI][Python] wheel-manylinux2014-* sometimes crashed on pytest exit
3 participants