Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316351 - [LTTng] SIGSEGV in the C library when parsing a v2.3 trace
Summary: [LTTng] SIGSEGV in the C library when parsing a v2.3 trace
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: LinuxTools (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Francois Chouinard CLA
QA Contact: Francois Chouinard CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 321366
  Show dependency tree
 
Reported: 2010-06-09 14:23 EDT by Alvaro Sanchez-Leon CLA
Modified: 2022-01-13 14:53 EST (History)
2 users (show)

See Also:


Attachments
seen when selecting same experiment muliple times (with traces in v 2.3. format) (21.19 KB, text/plain)
2010-06-09 14:26 EDT, Alvaro Sanchez-Leon CLA
no flags Details
switching 2.6 to 2.3 (18.75 KB, text/plain)
2010-06-09 14:30 EDT, Alvaro Sanchez-Leon CLA
no flags Details
close opened trace before opening new one (1.39 KB, patch)
2011-04-21 17:11 EDT, Francis Giraldeau CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alvaro Sanchez-Leon CLA 2010-06-09 14:23:27 EDT
A segmentation fault occurs sometimes when attempting to open an experiment including a trace in version 2.3 format, 

the environment used:
	- In a Virutal Machine using Virtual box 3.0.12
	- Using Ubuntu 9.10
	- PC 32 bits
	- Eclipse 
		Version: 3.6.0.v20090930-7b7kFHlFEx2XkxZQja7HFJ3
		Build id: I20100312-1448
	- JVM Sun 1.5.0.18
	
the problem has been reproduced by opening the same experiment multiple times
or switching from an experiment using traces in 2.6 format, to an experiment in using traces in 2.3 format
Comment 1 Alvaro Sanchez-Leon CLA 2010-06-09 14:26:30 EDT
Created attachment 171564 [details]
seen when selecting same experiment muliple times (with traces in v 2.3. format)
Comment 2 Alvaro Sanchez-Leon CLA 2010-06-09 14:30:47 EDT
Created attachment 171565 [details]
switching 2.6 to 2.3
Comment 3 Francis Giraldeau CLA 2011-04-21 16:57:56 EDT
The bug is related to the maximum opened files. For example, a trace with all channel activated on a 8 cores systems will yield a trace directory with 176 files that are all opened at reading time. The default opened files limit for a process on Linux is 1024. Eclipse itself uses about 240 files itself, there are 784 file descriptors left for traces, or only 4 "full" traces on a 8 cores system.

The provided patch closes traces from the current experiment before opening new ones. Hence, it prevent crash by opening and reopening traces multiple times.

This bug will also occur in experiments that open multiple traces exceeding the maximum opened file limits.
Comment 4 Francis Giraldeau CLA 2011-04-21 17:11:12 EDT
Created attachment 193888 [details]
close opened trace before opening new one
Comment 5 Francois Chouinard CLA 2011-06-01 17:28:21 EDT
I'm not sure about this one. The code you add clears the traces of a 'TmfExperiment' while we are managing an 'LTTngExperiment', two different beasts that shouldn't mix. In fact there should not be any instance of a TmfExperiment in the LTTng application. If there is, we have a much more serious problem (that could explain the multiplication of file handles).

I will run a few tests to see if this is the case.

I will also try to get a hold of a 2.3 trace. You wouldn't have one handy, would you? If so, could you attach it to the bug? Thanks.
Comment 6 Francois Chouinard CLA 2011-06-01 17:46:59 EDT
I ran the thing in Debug and everything looks OK. It seems that the only experiment live at any time is an LTTngExperiment (which extends TmfExperiment).

So the proposed patch has practically no effect since, in practice, fCurrentExperiment == TmfExperiment.getCurrentExperiment(). There is a slight side effect where the (empty) checkpoints table is cleared again. Another side effect is that the TmfExperimentDisposedSignal is issued twice but that should not be too serious.

A test with various trace formats is the next step.
Comment 7 Francis Giraldeau CLA 2011-06-02 15:08:08 EDT
Ugh... last patch is obviously silly, sorry for the inconvenience.

I retested and confirm the bug when an experiment contains more traces than the maximum allowed opened files. I can reproduce with 2.6 traces. 

The original bug looked a lot like the problem I had because the same function segfaults: 

C  [liblttvtraceread.so+0x6087]  Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent+0x7
Comment 8 Andrew Overholt CLA 2011-06-06 13:54:59 EDT
Unsetting target milestone for old bugs.
Comment 9 Patrick Tasse CLA 2013-05-17 17:26:38 EDT
Legacy LTTng support is being removed in Linux Tools 2.0.