New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 43425 - -fprofile-generate profile merging from concurrent processes fails on Windows with "LLVM Profile Error: Failed to write file ... File exists"
Summary: -fprofile-generate profile merging from concurrent processes fails on Windows...
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P enhancement
Assignee: Michael Holman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-24 02:38 PDT by Hans Wennborg
Modified: 2019-11-29 07:19 PST (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Wennborg 2019-09-24 02:38:11 PDT
For example, consider a simple program:

int main() {
	unsigned x = 1;
	for (int i = 0; i < 100*1000*1000; i++) {
		x *= i;
	}
	return 0;
}


built with instrumentation:

clang-cl -fprofile-generate=\src\tmp\ \src\tmp\a.cc

and run in an bunch of concurrent invocations (using e.g. Cygwin):

$ for i in `seq 1 100` ; do ./a.exe & done



A bunch of the program invocations fail to write their profile:

LLVM Profile Error: Failed to write file "\src\tmp\default_15822669652030248442_0.profraw": File exists
LLVM Profile Error: Failed to write file "\src\tmp\default_15822669652030248442_0.profraw": File exists
LLVM Profile Error: Failed to write file "\src\tmp\default_15822669652030248442_0.profraw": File exists



(This shows up when running instrumented tablegen binaries as part of building IR-instrumented Clang on Windows, see e.g. https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8901886476057032176/+/steps/package_clang/0/stdout)
Comment 1 Russell Gallop 2019-10-25 06:23:13 PDT
Bug seems to be present in 7.1.0/8.0.1 as well.
Comment 2 Hans Wennborg 2019-10-25 11:00:09 PDT
Yes, it probably never worked.

I have this on my tood list but I'm not sure when I'll get to it, so if someone else wants to take a look, please feel free :-)
Comment 3 Hans Wennborg 2019-10-25 11:00:25 PDT
> I have this on my tood list

*todo list
Comment 4 Hans Wennborg 2019-11-29 07:19:05 PST
Should be fixed by Michael's https://reviews.llvm.org/D70330