Can an error crash the whole app in production?

I understand this question might be too generic and not easily answered, but I’m just starting out investigating this and it’s kinda hard.

What happened: I was testing out my Django REST app in production for the first time, and an error happened. The error is described in this issue [BUG] <lambda>() missing 1 required positional argument: 'token' · Issue #83 · rsinger86/drf-access-policy · GitHub. If you can help me find the cause, that’s very welcomed, but the point of this thread is something else.

Basically, as I was checking the logs of my application and I saw that error, I noticed that after that, the app stopped working. No HTTP requests would get through (nothing showing in the logs), and the app was unreachable by the users (including the admin panel by me).

I had to rebuild the application in order for it to resume working.

My question is: what I’ve observed every time I’d test an application in production was that whatever runtime error ever happened while handling a request, the application would resume working afterwards. Can an exception cause the application to completely stop working and require a redeploy? If so, assuming the error is outside my control (as would be in the case of a bug in an external library (*)), what can I do to prevent that from crashing my application?

(*) To make things weirder, the method that caused the error was called hundreds of times before AND after the crash without issues.

It depends a lot upon how you’re running Django.

In a proper deployment, you’re running Django within some type of WSGI container application such as uwsgi, behind a web server such as nginx. That type of setup is designed to run Django as a set of processes, and restart them when they fail.