-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Python] Bug async api call producing "RuntimeError: cannot join current thread" #712
Comments
See also swagger-api/swagger-codegen#8504 |
This would be awesome to get merged. My program is now running single process because I'd rather have |
@spacether it should at least allow the user to manually close the thread properly (or use the context manager). It might still happen |
Curious to know what others are using as workaround. |
Description
There's an Python program making some asynchronous API calls by passing
async=True
to the generated default API methods. Then an exception was thrown at the end of program(no such error if no async calls):openapi-generator version
3.1.2
OpenAPI declaration file content or url
https://raw.githubusercontent.com/EvanCui/hpc-acm/master/src/Swagger/swagger.yaml
Command line used for generation
Steps to reproduce
I tried to reproduce the problem with a minimum code sample but haven't got it. But the debugging output clearly shows the problem rooted in
src/main/resources/python/api_client.mustache
From the following debug output you can see del was executed on a thread which tried to join itself later, while in my minimum code sample it's on the main thread and then everything is OK. So we can assume that del is called by Python GC and can be run on a random thread besides the main thread.
Related issues/PRs
Suggest a fix/enhancement
I suggest either
try
to ignore the exception, or make a normal "close" method to be called by user manually.The text was updated successfully, but these errors were encountered: