Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366612 - A lot of jar files in project causes TPTP to timeout when launching profile
Summary: A lot of jar files in project causes TPTP to timeout when launching profile
Status: ASSIGNED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Torsten Stolpmann CLA
QA Contact: Torsten Stolpmann CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-13 14:39 EST by PDL PDL CLA
Modified: 2016-05-05 11:21 EDT (History)
4 users (show)

See Also:


Attachments
ServiceLog in DEBUG (25.88 KB, application/x-zip-compressed)
2012-01-02 09:17 EST, PDL PDL CLA
no flags Details
Patch reallocating the buffer size if message is too big... (5.02 KB, application/octet-stream)
2012-02-06 08:01 EST, PDL PDL CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description PDL PDL CLA 2011-12-13 14:39:04 EST
Build Identifier: M20110210-1200

My Eclipse project has a lot of librairies (180) into one folder (lib).

When this lib folder is C:\lib, everything is OK, i can profile my sample java code.
When this lib folder is C:\Users\XXXXXX\workspace\demodemodemo\demodemodemo\lib, TPTP fails with timeout and the following stacktrace : 

org.eclipse.core.runtime.CoreException
A time-out occurred while attempting to launch the process

org.eclipse.core.runtime.CoreException: A time-out occurred while attempting to launch the process
  at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.createCoreException(LauncherUtility.java:124)
  at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.createCoreException(LauncherUtility.java:132)
  at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.handleError(TIDelegateHelper.java:783)
  at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launchProcess(TIDelegateHelper.java:699)
  at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launch(TIDelegateHelper.java:403)
  at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIJavaLauncherDelegate.launch(TIJavaLauncherDelegate.java:37)
  at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.delegateInit(LauncherUtility.java:1164)
  at org.eclipse.tptp.trace.ui.provisional.launcher.PrimaryLaunchDelegate.run(PrimaryLaunchDelegate.java:195)
  at java.lang.Thread.run(Thread.java:619)

Reproducible: Always

Steps to Reproduce:
1. Create a Java Project with only one Java class with main method
2. Create a lib folder with a lot of jar files (+180)
3. References all jar file in BuildPath Configuration
4. Launch profiling
Comment 1 Torsten Stolpmann CLA 2011-12-15 05:26:19 EST
I am suspecting that you are hitting an OS limitation for the maximum command line length here.

AFAIK this would be 8191 characters for Windows 7 which would fit quite nicely with the example you gave here.

Given the current overall TPTP architecture I see no feasible way to circumvent this.
Comment 2 PDL PDL CLA 2011-12-15 05:54:12 EST
I simplified the original issue for bug reporting, but this bug was discovered with librairies stored in Maven repository.

As you know, this kind of repository has very long path for each jars, so this bug will specially impact Maven Projects with lots of dependencies.
Comment 3 Torsten Stolpmann CLA 2011-12-15 06:56:06 EST
I see your pain in this yet I really see no way what TPTP can do to help you.

The command line limitation occurs when the profiled process is launched by the agent controller assembling all of the supplied jars into the class path argument of the java command line invocation.

Exceeding the OS limit will truncate the command line at the limit location and will break the profiling process call thus leading to the time-out shown below.

AFAIK this is not a bug and I see no way to circumvent this besides using an operation system allowing longer command lines (Linux).
Comment 4 PDL PDL CLA 2012-01-02 08:51:13 EST
I tried to profile the same project on Linux Fedora, but profiling failed to start and AC reports broken pipes errors (see below).

When I remove all libraries from classpath, profiling is OK.


-----------------------------------
Starting Agent Controller.
ACServer started successfully.
[root@fedora15 bin]# java.net.SocketException: Relais brisé (pipe)
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:124)
        at org.eclipse.tptp.platform.execution.client.core.internal.ConnectionImpl.sendMessage(ConnectionImpl.java:528)
        at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.sendCommand(AgentController.java:1497)
        at org.eclipse.tptp.platform.execution.client.agent.internal.AgentImpl.sendCommand(AgentImpl.java:353)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.sendFilters(TIDelegateHelper.java:1465)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.sendFilters(TIDelegateHelper.java:1487)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:879)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:804)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.access$7(TIDelegateHelper.java:802)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper$2.processLaunched(TIDelegateHelper.java:633)
        at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launchAC(ProcessImpl.java:701)
        at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launch(ProcessImpl.java:130)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launchProcess(TIDelegateHelper.java:678)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launch(TIDelegateHelper.java:403)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIJavaLauncherDelegate.launch(TIJavaLauncherDelegate.java:37)
        at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.delegateInit(LauncherUtility.java:1164)
        at org.eclipse.tptp.trace.ui.provisional.launcher.PrimaryLaunchDelegate.run(PrimaryLaunchDelegate.java:195)
        at java.lang.Thread.run(Thread.java:662)
java.net.SocketException: Socket is closed
        at java.net.Socket.getOutputStream(Socket.java:828)
        at org.eclipse.tptp.platform.execution.client.core.internal.ConnectionImpl.sendMessage(ConnectionImpl.java:522)
        at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.sendCommand(AgentController.java:1497)
        at org.eclipse.tptp.platform.execution.client.agent.internal.AgentImpl.sendCommand(AgentImpl.java:353)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.sendOptions(TIDelegateHelper.java:1220)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:880)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:804)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.access$7(TIDelegateHelper.java:802)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper$2.processLaunched(TIDelegateHelper.java:633)
        at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launchAC(ProcessImpl.java:701)
        at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launch(ProcessImpl.java:130)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launchProcess(TIDelegateHelper.java:678)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launch(TIDelegateHelper.java:403)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIJavaLauncherDelegate.launch(TIJavaLauncherDelegate.java:37)
        at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.delegateInit(LauncherUtility.java:1164)
        at org.eclipse.tptp.trace.ui.provisional.launcher.PrimaryLaunchDelegate.run(PrimaryLaunchDelegate.java:195)
        at java.lang.Thread.run(Thread.java:662)
java.net.SocketException: Socket is closed
        at java.net.Socket.getOutputStream(Socket.java:828)
        at org.eclipse.tptp.platform.execution.client.core.internal.ConnectionImpl.sendMessage(ConnectionImpl.java:522)
        at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.sendCommand(AgentController.java:1497)
        at org.eclipse.tptp.platform.execution.client.agent.internal.AgentImpl.sendCommand(AgentImpl.java:353)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.configureDataProcessor(TIDelegateHelper.java:970)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:889)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:804)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.access$7(TIDelegateHelper.java:802)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper$2.processLaunched(TIDelegateHelper.java:633)
        at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launchAC(ProcessImpl.java:701)
        at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launch(ProcessImpl.java:130)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launchProcess(TIDelegateHelper.java:678)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launch(TIDelegateHelper.java:403)
        at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIJavaLauncherDelegate.launch(TIJavaLauncherDelegate.java:37)
        at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.delegateInit(LauncherUtility.java:1164)
        at org.eclipse.tptp.trace.ui.provisional.launcher.PrimaryLaunchDelegate.run(PrimaryLaunchDelegate.java:195)
        at java.lang.Thread.run(Thread.java:662)
Comment 5 PDL PDL CLA 2012-01-02 09:17:32 EST
Created attachment 208918 [details]
ServiceLog in DEBUG
Comment 6 PDL PDL CLA 2012-02-06 08:01:52 EST
Created attachment 210574 [details]
Patch reallocating the buffer size if message is too big...

Here is a patch allowing to test the use case with success on linux 32 bits. The size of the buffer is realloc()'ed if necessary, but there should be a maximum size to prevent memory exhaustion.

What remains to be made now is to make this maximum buffer size configurable, unless there is a way in the upper layer to break the message into smaller parts...
Comment 7 Adrien Cunin CLA 2013-02-15 05:26:04 EST
Hi,

What's the status of this patch?