Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #715 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

using Process.kill deletes all pipes used to read stderr/stdout

Reported by: schveiguy Assigned to: jcomellas
Priority: major Milestone: 0.99.4
Component: Core Functionality Version: 0.99.2 Don
Keywords: Cc:

Description

The current implementation of Process.kill() destroys all the pipes used to read the data. However, the following sequence of events should be valid:

  1. start process
  2. kill process
  3. read data on process.stdout until eof

However, the current code results in a segfault on the third step.

Two things should be fixed, first, the clean function should set the pipe values to null. Second, I think the pipe conduits should not be deleted on kill() or wait() because there may be data that is still on the pipe that could be read by the process. Simply setting the values to null should be sufficient. Note that the destructor of DeviceConduit? already calls close() so the GC will eventually close the pipe if the pipe was not saved outside the Process object.

Also note that clean() is called by the destructor of Process, which left in its current form (calling delete for each pipe) could be dangerous.

Change History

10/30/07 17:28:47 changed by schveiguy

  • summary changed from using Process.kill deletes all pipes used to read stdin/stdout to using Process.kill deletes all pipes used to read stderr/stdout.

10/30/07 17:31:20 changed by schveiguy

Oops, I realized that setting all pipes to null would also make my code fail :)

Better change it to just not doing anything to the conduits with kill (or wait for that matter).

10/30/07 17:36:30 changed by larsivi

  • owner changed from sean to jcomellas.
  • milestone set to 0.99.3.

11/13/07 04:50:08 changed by larsivi

  • milestone changed from 0.99.3 to 0.99.4.

schveiguy; do you have a patch for this?

11/13/07 10:04:00 changed by jcomellas

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r2872. The Process pipes are now preserved past the death of the child process, whether you call wait() or kill(). If the Process is re-executed the previous pipes are deleted and new ones are created.

Please test the changes thoroughly as I'm not doing much with D these days.