On Fri, 18 Nov 2016 10:56:37 -0800
Roger Binns <rog...@rogerbinns.com> wrote:

> Popen calls fork (it seems like you are doing Unix/Mac, not Windows).
> fork() duplicates the process including all open file descriptors.
> One or more of those descriptors belong to open SQLite databases and
> ancillary files.

Good catch, Roger.  It's a liability, but I slightly disagree with your
characterization.  

> - Running any Python code (destructors can be called which then run in
> the parent and child)

Yes, if those destructors affect shared resources.  The OP did say the
processes on the other side of popen were C programs.  

> - Not having file descriptors closed so the child process trashes them
> (close_fds Popen argument is False in python 2.x but True in python
> 3.x).  

The child process can't "trash" the parent's descriptors.  When the
child exits, the OS will close its descriptors, that's all.  But, yes,
if the child process is making some assumption about open descriptors
it receives at startup, that could be lead to problems.  Especially if
it scribbles on the SQLite database.  

> Also python 2.x subprocess module is broken in many ways.

My foray into Unicode in Python convinced me once and for all that
Python 3 is the only way to go.  But would you care to elaborate on the
problems with 2.x subprocess?  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to