Intermediate Log Reading #stack-traces #debugging #exceptions #error-analysis

Reading Stack Traces

5 exercises — Python, Java, and Node.js stack traces. Identify the root exception, locate the application code frame, distinguish library internals from your bugs, and recognise recursion errors.

0 / 5 completed
Stack trace reading strategy (any language)
  • Step 1: Read the exception name and message — understand WHAT failed
  • Step 2: Find your application's frames — look for your package/path (not node_modules, not java.lang, not site-packages)
  • Step 3: The top-most app frame = where you entered the call chain; the bottom-most = closest to the crash
  • Step 4: Library frames below your code = proximate cause; look above for the application bug
  • Repeated frame: infinite recursion — find the missing base case or cycle
1 / 5
A Python stack trace ends with:
Traceback (most recent call last):
File "app.py", line 47, in process_order
result = db.execute(query, params)
File "/usr/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1774, in execute
return self._exec_single_context(...)
File "/usr/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1822, in _exec_single_context
self.dialect.do_execute(...)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) SSL connection has been closed unexpectedly


Which line should an on-call engineer look at first to understand what went wrong in the application code?