Good news everyone!

We just wanted to give you a quick update on PDB debugging support in the 
new dev_appserver. 

One of the key design goals of the new dev_appserver was to provide a more 
faithful emulation of how your application performs in production - 
including servicing each incoming request in a separate thread or process. 
This not only makes your local development faster, but also means issues 
(such as race conditions) that may arise from concurrent requests executing 
in parallel can be more easily identified and corrected.

However a development environment with multiple concurrent threads and 
processes can present a challenge when using a command line debugger such 
as PDB. We’ve been working on reconciling our design goal of a 
dev_appserver that supports production-like concurrency while still 
allowing developers to use tools like PDB to introspect and debug their 
code in a sensible, serialised way.

We’ve made some progress on this front recently, and wanted to share it 
with you.

The latest release 1.8.3 of the Python SDK supports PDB. That is you can 
add a line such as:

import pdb; pdb.set_trace();

into your code, and dev_appserver2 will break at this point, and drop into 
the PDB REPL, allowing you to debug your code from the command line.

However, a note of caution - if you make multiple simultaneous requests 
that invoke pdb.set_trace(), then two debugging sessions will start 
concurrently and both will send output to STDOUT. This can lead to 
unpredictable debugging experiences.

To help prevent this, you can also disable some of the dev_appserver’s 
multi-threading and multi-processing support. 

   - 
   
   Multi-threading can be disabled by modifying your app.yaml and setting 
   thread_safe to false. 
   - 
   
   For a given module, you can disable multi-processing using the 
   --max_module_instances=1 flag.
   

Using these techniques you can serialize your requests. Note that, if you 
are using App Engine modules in your application, the dev_appserver will 
still serve multiple requests simultaneously for different modules.

We hope you enjoy this early support for pdb in dev_appserver2. Please let 
us know what you think.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to