Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359502

Summary: [TCF][agent] segmentation fault in tcf agent when using CDT remote launch plugin to run remote applications
Product: [Tools] TCF Reporter: Lianhao Lu <lianhao.lu>
Component: AgentAssignee: Project Inbox <tcf.agent-inbox>
Status: NEW --- QA Contact: Eugene Tarassov <eugene>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Lianhao Lu CLA 2011-09-29 22:07:51 EDT
Build Identifier: Eclipse: 3.7.0 I20110613-1736, CDT remote launch: 6.0.0.201106081058

When repeatedly using the CDT remote launch plugin(org.eclipse.cdt.launch.remote) to run the remote application based on TCF connection, sometimes it will trigger a segmentation fault in tcf-agent. 

This segfault began to appear in svn revision 1290(r1290) and afterwards, before that there seemed no such segfault. 

By debug the core dump file generated by the segfault, would see the stack trace like the following. It seems that the multi-thread concurrency improvement made in r1290 might bring some potential memory overrun issues back into the front stage.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7c06b70 (LWP 8350)]
0xb7ce6e43 in __GI___libc_malloc (bytes=20) at malloc.c:3615
3615    {

(gdb) bt
#0  0xb7ce6e43 in __GI___libc_malloc (bytes=20) at malloc.c:3615
#1  0xb7ce6fe5 in __GI___libc_malloc (bytes=20) at malloc.c:3622
#2  0xb7ce6fe5 in __GI___libc_malloc (bytes=20) at malloc.c:3622
#3  0xb7ce6fe5 in __GI___libc_malloc (bytes=20) at malloc.c:3622
... ...
(hundreds of the same frame info)
... ...
#786 0xb7ce6fe5 in __GI___libc_malloc (bytes=20) at malloc.c:3622
#787 0x0804e8a1 in loc_alloc_zero (size=20) at framework/myalloc.c:49
#788 0x0805436b in post_event_with_delay (handler=0x80521e7
<tcp_channel_read_done>, 
    arg=0x80cf218, delay=0) at framework/events.c:105
#789 0x0805469c in post_event (handler=0x80521e7 <tcp_channel_read_done>,
arg=0x80cf218)
    at framework/events.c:155
#790 0x0804ffe6 in worker_thread_handler (x=0x80d2368) at
framework/asyncreq.c:184
#791 0xb7fbe997 in start_thread (arg=0xb7c06b70) at pthread_create.c:304
#792 0xb7d4227e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

Reproducible: Sometimes

Steps to Reproduce:
1. Set up a run configuration using the TCF connection under the category "C/C++ Remote Application" in menu "Run"->"Run Configurations..."
2. Repeatedly run the previous set run configuration.
Comment 1 Eugene Tarassov CLA 2011-09-30 14:35:22 EDT
I cannot reproduce it.
Both r1290 and latest code work fine for me.
Could you provide more details: OS version, agent configuration, any agent plugins used?
Comment 2 Lianhao Lu CLA 2011-10-01 21:12:08 EDT
In my test environment, the segment fault happened when the tcf-agent was running in the QEMU, emulating a x86 machine. The agent was compiled with the default configurations with out any plugins.