Message239374
Emil,
Your example child process opens the file with only read sharing, which fails with a sharing violation if some other process inherits the file handle with write access. The `with` block only prevents this in a single-threaded environment. When you spawn 10 children, each from a separate thread, there's a good chance that one child will inherit a handle that triggers a sharing violation in another child.
Using close_fds is a blunt solution since it prevents inheriting all inheritable handles. What you really need here has actually already been done for you. Just use the file descriptor that mkstemp returns, i.e. use os.fdopen(infd, 'wb'). mkstemp opens the file with O_NOINHERIT set in the flags. |
|
Date |
User |
Action |
Args |
2015-03-27 04:15:18 | eryksun | set | recipients:
+ eryksun, terry.reedy, amaury.forgeotdarc, ggenellina, eckhardt, javen72, brian.curtin, Emil.Styrke |
2015-03-27 04:15:18 | eryksun | set | messageid: <1427429718.39.0.708168334628.issue4944@psf.upfronthosting.co.za> |
2015-03-27 04:15:18 | eryksun | link | issue4944 messages |
2015-03-27 04:15:17 | eryksun | create | |
|