-
Notifications
You must be signed in to change notification settings - Fork 522
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 Container exits without logs in certain cases #1831
Comments
IMO this is kinda a self-inflicted issue. Our scaffolding will do non-root if all ports are >1023, and root otherwise, so what we scaffold works--of course, it's impossible to stop users from creating something that doesn't work. In general, this falls into the class of "startup errors". Because Python (and Node) do attach instead of launch (like .NET does), this means startup errors may happen before we have a chance to attach...which means they are missed and the container stops. We still need to clean up containers in general because we cannot run a new one until the old one is gone, but there may be ways to change the timing of that, or possibly detect containers that shut down immediately before attach. |
I think the problem here is that when the exception is thrown (due to the permission issue), it doesn't get written in the debug console. You can still debug and set breakpoints fine, so I don't think it is a startup issue since ptvsd doesn't execute the app process until something attaches to it. |
In that case would this be a ptvsd issue? If anything, exceptions outta make it to the debug console. |
Might be, I opened an issue over there: microsoft/ptvsd#2117 |
From that issue, it sounds like data is being written to stderr but Django is terminating itself before stderr is flushed. |
When a user does the repro steps below, by default, the container starts and exits immediately without writing any meaningful error logs in the Debug Console.
Repro Steps:
Add in
Current solution to diagnose this issue:
Although it's possible to find out what's really happening in the container, it is a pain and the user cannot be expected to know/do these steps mentioned below.
In a Django app, you will see the error:
In a Flask app, you may see the error:
This likely means you are exposing a system-port (ports 0 - 1023) while attempting to run as a non-root user. This incompatible configuration is demonstrated in the image above, but there must be an easier way to find this issue.
The text was updated successfully, but these errors were encountered: