After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674930 - Logging to a file causes loss of logs when forking
Logging to a file causes loss of logs when forking
Status: RESOLVED DUPLICATE of bug 773092
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-27 09:46 UTC by Vincent Penquerc'h
Modified: 2016-10-29 14:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
log file (with colors) (872.48 KB, text/plain)
2013-11-05 12:56 UTC, Reynaldo H. Verdejo Pinochet
  Details
Showing corruption (993.07 KB, application/x-gzip)
2013-11-05 13:08 UTC, Vincent Penquerc'h
  Details
Allow %p in log file (3.61 KB, patch)
2016-10-27 13:46 UTC, Vincent Penquerc'h
none Details | Review

Description Vincent Penquerc'h 2012-04-27 09:46:13 UTC
GST_DEBUG=5 GST_DEBUG_FILE=gst.log gst-inspect -a

gst.log will be corrupt. This happens when more than one process spawned by the gst using program tries to open the log file for writing.

I guess it could be solved by having a semaphore protect writes to the file, but that might cause a large slowdown (not tried).

Preventing all but the first log prevents the corruption, but also loses the logs from those processes.

Another way could be to let subsequent processes open a different file, maybe named with their PID as a suffix (maybe using % format string in the GST_DEBUG_FILE variable, such as "gst.%p.log", and replacing %p by PID. Could do that for date/time too).
Comment 1 Reynaldo H. Verdejo Pinochet 2013-11-04 21:47:06 UTC
Can't reproduce. Seems to have been fixed on master. Is anyone still experiencing this? Vincent: Any chances you can elaborate on what's intended here by
"corrupt"? A sample log file showing the issue would be great too.
Comment 2 Tim-Philipp Müller 2013-11-04 21:55:04 UTC
It is unclear to me what would have fixed this though.
Comment 3 Sebastian Dröge (slomo) 2013-11-05 08:32:46 UTC
Yeah, there wasn't really something that touched this code. Writing to the same file from multiple processes at the same time just has this behaviour unless you explicitly synchronize the processes or just use different files.

I think something like Vincent's suggestion to use %p makes sense, and additionally lock the file so that if it's still the same file only the first process can ever write to it.
Comment 4 Reynaldo H. Verdejo Pinochet 2013-11-05 12:56:46 UTC
Created attachment 259011 [details]
log file (with colors)
Comment 5 Reynaldo H. Verdejo Pinochet 2013-11-05 12:58:00 UTC
Then and as I mention before I'm not getting the meaning of 'corruption'
right. 

I'm attaching somewhat of a huge 14M log captured with the description
cmd line (compressed). Can anyone point out where is this corruption
visible on the file?

Was tempted to go GST_DEBUG_NO_COLOR but went without it (tried though and
didn't see any 'corruption' neither).
Comment 6 Tim-Philipp Müller 2013-11-05 13:08:54 UTC
Your logging file output is all from one process...
Comment 7 Vincent Penquerc'h 2013-11-05 13:08:57 UTC
Created attachment 259012 [details]
Showing corruption

I don't have an up to date master to test with, but with good old 0.10.36, this is what corruption is like. I had to rm ~/.gstreamer-0.10/registry* for this to happen (line 96). Lots of zeroes which make me think of concurrent accesses in write mode.

If this doesn't happen with master after removing registries (if they still exist in 1.0), then this can be closed I guess.
Comment 8 Reynaldo H. Verdejo Pinochet 2013-11-05 15:50:16 UTC
Oh, my bad. Was testing from an uninstalled environment and had to
remove gstreamer/registry.dat to reproduce. Confirmed them ;) file
gets corrupted with the aforementioned cmd line, with master as of
today and under the conditions outlined by Vincent.
Comment 9 Vincent Penquerc'h 2016-10-27 13:46:21 UTC
Created attachment 338611 [details] [review]
Allow %p in log file
Comment 10 Tim-Philipp Müller 2016-10-27 14:05:36 UTC

*** This bug has been marked as a duplicate of bug 773092 ***
Comment 11 Vincent Penquerc'h 2016-10-27 14:16:54 UTC
Good timing :D