Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328637 - XML Trace is printed to the console (stderr) when using ProbekitAgent in standalone mode in Linux
Summary: XML Trace is printed to the console (stderr) when using ProbekitAgent in stan...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Mike Reid CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-25 12:57 EDT by Victor Atomitl Garcia Toral CLA
Modified: 2016-05-05 11:02 EDT (History)
1 user (show)

See Also:


Attachments
Patch (1.49 KB, patch)
2010-12-01 09:26 EST, Mike Reid CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Atomitl Garcia Toral CLA 2010-10-25 12:57:24 EDT
Build Identifier: 4.7.1.1

When executing the command: -agentpath:'org.eclipse.tptp.platform.jvmti.runtime_4.6.2.v201009281431/agent_files/linux_ia32/libJPIBootLoader.so=JPIAgent:server=standalone,file=;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=/temp/t1/psfile1'

The following trace is printed to the console:

<?xml version="1.0"?>
<TRACE>
<node nodeId="" hostname="localhost" ipaddress="127.0.0.1" timezone="240" time="1288022657.927753000"/>
<processCreate processId="D8B51F37-A16D-4DBB-98FB-F5EE60EE0590" pid="10885" nodeIdRef="" time="1288022657.927753000"/>
<agentCreate agentId="E55291F5-8E07-47D6-8F2E-F604371F61C3" version="2.000" processIdRef="D8B51F37-A16D-4DBB-98FB-F5EE60EE0590" agentName="org.eclipse.tptp.jvmti" agentType="Profiler" agentParameters="server=standalone,file=" time="1288022657.927753000"/>
<traceStart traceId="04BC7B2F-D3F8-45AE-9BF4-07E917DB10B7" agentIdRef="E55291F5-8E07-47D6-8F2E-F604371F61C3" time="1288022658.181815000"/>
<option key="FILTERS" value="true"/>
<option key="OPTIONS" value="true"/>
<option key="STACK_INFORMATION" value="normal"/>
<option key="TICKET" value="true"/>
<option key="TIMESTAMPS" value="true"/>
<option key="TRACE_IDREFS" value="false"/>
<option key="CPU_TIME" value="false"/>

This trace does not affect the functionality of the agent, which other than this behaves normally. Only found on Linux (tried Red Hat 5.5 and reproduced on 2 different machines). When redirecting the stdout of the command to a file using the > operator, the trace still shows in the console so I assume its being printed to stderr. 

Reproducible: Always
Comment 1 Mike Reid CLA 2010-11-26 17:21:37 EST
It's actually being printed to stdout; and the reason is that the given command specifies: 'file='.

The output intialization code specifically detects a blank filename (ECJvmtiAgent.cpp:175) and simply skips opening the file. The result is that the file handle retains its default value (i.e. 0) which on Unix platforms is equal to stdout. Unsure how this behaves on Windows, but it would either be the same or simply no output.

Seems this can be handled either by not filtering the blank filename, which likely results in an error that the output file could not be opened; or an alternative branch could be added that falls back to the default file name.

Containable for 4.7.2.
Comment 2 Mike Reid CLA 2010-11-29 13:52:51 EST
Correction, file descriptor 0 is the stdin file descriptor. Strangely on Linux it seems to be that if you write() to stdin it appears on the console.

Allowing an empty filename to bypass initializing the output file was added for bug 296510. I think the fix here simply needs to prevent calling write() if the file descriptor has not been initialized.
Comment 3 Mike Reid CLA 2010-12-01 09:26:52 EST
Created attachment 184260 [details]
Patch

Attached patch that skips write()ing to the file handle if it is uninitialized.
Comment 4 Mike Reid CLA 2010-12-01 09:48:45 EST
Checked into HEAD.
Comment 5 Kathy Chan CLA 2011-02-11 13:45:33 EST
This defect had been resolved as FIXED for more than 1 month.  Please verify with the latest TPTP 4.7.2 driver.  If this defect is still left unverified by February 25, we'll close it on the originator's behalf.

TPTP 4.7.2 driver can be downloaded from:

http://www.eclipse.org/tptp/home/downloads/?ver=4.7.2
Comment 6 Victor Atomitl Garcia Toral CLA 2011-02-18 13:59:44 EST
Verified in TPTP 4.7.2