Bug 284004

Summary: Application under test hangs after call to __posix_spawn
Product: [Developer tools] valgrind Reporter: Rich Siegel <siegel>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: normal CC: tim
Priority: NOR    
Version: 3.7 SVN   
Target Milestone: ---   
Platform: unspecified   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rich Siegel 2011-10-14 14:38:55 UTC
Version:           3.7 SVN
OS:                OS X

My (nontrival) application runs a Python script at startup, using NSTask. [NSTask run] calls posix_spawn() and thereafter a hang results.

Reproducible: Always

Steps to Reproduce:
The code looks like this:

		NSString *toolPath = @"/path/to/my/script.py";
		NSTask *task = [[[NSTask alloc] init] autorelease];
		
		[task setLaunchPath: toolPath];
		[task setArguments: [NSArray arrayWithObject: @"dropbox_path"]];
		[task setStandardOutput: [NSPipe pipe]];

		[task launch];

valgrind --dsymutil=yes /path/to/compiled/application.app



Actual Results:  
In Valgrind, the [task launch] call results in this error:

==45482== Syscall param posix_spawn(pid) points to unaddressable byte(s)
==45482==    at 0x456F77A: __posix_spawn (in /usr/lib/system/libsystem_kernel.dylib)
==45482==    by 0x2F0D750: -[NSConcreteTask launchWithDictionary:] (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==45482==    by 0x2F0C531: -[NSConcreteTask launch] (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
.
.
.

==45482==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

After reporting this error, the application under test hangs. Control-C in the terminal window running valgrind will kill the application (and end the valgrind session).


Expected Results:  
Normal program startup.

Building from trunk, r12155.

uname -a output:

Darwin Volante.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64

(10.7.2)

Also reproducible on:

Darwin boombox.private 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

(10.6.8 Server)

This is the simplest example; if I comment out this call, other places where __posix_spawn gets called will hang in a similar fashion.

If it matters, my application is 32-bit (i386), I have not yet tried to reproduce using a 64-bit program.
Comment 1 Julian Seward 2012-08-02 10:44:12 UTC
Can you post a complete test program, + compile commands, that I can
repro with?
Comment 2 Julian Seward 2012-08-17 10:18:37 UTC

*** This bug has been marked as a duplicate of bug 301281 ***