-
Notifications
You must be signed in to change notification settings - Fork 74
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
Segmentation Fault on Python application exit with Python 3.9.5 #1050
Labels
Comments
This issue persist with Python 3.10.4. |
Related to pybind11 documented issue 3108. |
I doubt this is a real fix, but I've worked around this problem with the following: index 135fe85b..a4f42608 100644
--- a/sdk/python/core/python.cpp
+++ b/sdk/python/core/python.cpp
@@ -92,10 +92,15 @@ void setup_logging()
add_null_handler(logger);
log_debug = logger.attr("debug");
+ log_debug.inc_ref();
log_info = logger.attr("info");
+ log_info.inc_ref();
log_warning = logger.attr("warning");
+ log_warning.inc_ref();
log_error = logger.attr("error");
+ log_error.inc_ref();
log_critical = logger.attr("critical");
+ log_critical.inc_ref();
ydk::set_logging_callback("debug", debug);
ydk::set_logging_callback("info", info);
diff --git a/sdk/python/gnmi/python_gnmi.cpp b/sdk/python/gnmi/python_gnmi.cpp
index 7569e374..a424fd70 100644
--- a/sdk/python/gnmi/python_gnmi.cpp
+++ b/sdk/python/gnmi/python_gnmi.cpp
@@ -82,10 +82,15 @@ static void setup_gnmi_logging()
add_null_handler(logger);
log_debug = logger.attr("debug");
+ log_debug.inc_ref();
log_info = logger.attr("info");
+ log_info.inc_ref();
log_warning = logger.attr("warning");
+ log_warning.inc_ref();
log_error = logger.attr("error");
+ log_error.inc_ref();
log_critical = logger.attr("critical");
+ log_critical.inc_ref(); |
ygorelik
pushed a commit
to ygorelik/ydk-gen
that referenced
this issue
Feb 6, 2023
Applied this fix to maintenance release 0.8.6.5 (under development). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current Behavior
When upgraded Python to version 3.9.5, it is noticed that all YDK Python applications exit with Segmentation Fault.
Investigation showed that this is well known Python 3.9 issue documented in multiple resources; here is one of them.
Root cause: At application exit the pybind objects got deleted AFTER corresponding memory was released.
Steps to Reproduce
After Python upgrade/installation to version 3.9.x and YDK installation run sanity test and notice segmentation fault:
Logs
The following application crash information was obtained on MACOS Mojave with Python 3.5.9:
System Information
YDK installation on MACOS Mohave with Python 3.9.5.
Workaround
Downgrade Python to version 3.7.x, which is proven to be stable for YDK applications.
The text was updated successfully, but these errors were encountered: