Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 186807 - after detach from agent, reattach fails with java.lang.NullPointerException
Summary: after detach from agent, reattach fails with java.lang.NullPointerException
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 blocker (vote)
Target Milestone: ---   Edit
Assignee: Guru Nagarajan CLA
QA Contact:
URL:
Whiteboard: closed460
Keywords:
: 190494 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-05-14 11:15 EDT by Alan Haggarty CLA
Modified: 2016-05-05 10:42 EDT (History)
3 users (show)

See Also:


Attachments
Here's the patch that avoid the NPE (3.56 KB, patch)
2007-05-31 15:01 EDT, amehrega CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Haggarty CLA 2007-05-14 11:15:26 EDT
Build ID: I20070503-1400

Steps To Reproduce:
1. Profile StartStop by launching as an external java application
and profiling for execution statistics (jdk 1.5+)
2. detach from agent
3. attach to agent

result is an error in the workbench:

"An unexpected error occurred while attempting to establish
a connection with the JVMTI agent."

details:
java.lang.NullPointerException
null

java.lang.NullPointerException
  at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:574)
  at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:538)
  at org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIAgentControlProvider$TIAgentStateModifier.doAction(TIAgentControlProvider.java:321)
  at org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIAgentControlProvider$TIAgentStateModifier.performCollectiveAction(TIAgentControlProvider.java:271)
  at org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIAgentControlProvider$TIAgentStateModifier.attach(TIAgentControlProvider.java:221)
  at org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider$1$AttachControlItem.run(AbstractAgentControlProvider.java:108)
  at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
  at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
  at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
  at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3673)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284)
  at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2365)
  at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2329)
  at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2204)
  at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:615)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1137)



More information:

StartStop is a test class from the automation framework:
/org.eclipse.tptp.ac.testautomation/automation-files/external_classes/StartStop.class
Likely any class that will not run to completion right away can be used.

This is reproduced using the 4.4.0-200705080100A build.
Comment 1 Alan Haggarty CLA 2007-05-14 11:17:33 EDT
This causes failures in DetachAttachTest* profiler test cases.
Comment 2 Guru Nagarajan CLA 2007-05-15 11:27:19 EDT
This is a known issue gated by 183001
Comment 3 Eugene Chan CLA 2007-05-17 19:36:02 EDT
This is failing profile to file testcase as well.
Comment 4 Eugene Chan CLA 2007-05-17 19:36:36 EDT
Raise this as blocker as it's a regression.
Comment 5 Guru Nagarajan CLA 2007-05-30 19:37:31 EDT
Ali,
  The failure is when you attach to an agent when there is no launchConfig info passed. Do you persist that info on a per run basis? How did you do it for PI?
I am assigning it to you. This issue is not gated by 183001 now
Comment 6 amehrega CLA 2007-05-31 15:01:03 EDT
I agree that it doesn't depend on 183001.  TIDelegateHelper.attachToAgent can have launchConfiguration == null in the case when the user selects a detached agent and re-attaches.  I have added some code to avoid the NPE exception but the data after a re-attach is sent to the old agent instead of the new one.

I can't figure out why this is happening.  It seems that the data processor registered during the second round with the TI agent is never invoked.  Guru, I will shortly attach a patch that will avoid the NPE exception.  Can you investigate why the execution framework is not invoking the second data processor that is registered in TIDelegateHelper.configureDataProcessor(...)?

Liz, you have added some code that assumes launchConfiguration is not null in attachToAgent.  I have added an if-block around your code.
Comment 7 amehrega CLA 2007-05-31 15:01:38 EDT
Created attachment 69579 [details]
Here's the patch that avoid the NPE
Comment 8 Guru Nagarajan CLA 2007-05-31 16:50:38 EDT
Thanks Ali. I will investigate the data processor issue
Comment 9 Liz Dancy CLA 2007-05-31 17:57:02 EDT
Thanks Ali, the if block looks fine.
Comment 10 Guru Nagarajan CLA 2007-06-01 12:04:05 EDT
*** Bug 190494 has been marked as a duplicate of this bug. ***
Comment 11 Guru Nagarajan CLA 2007-06-11 18:59:39 EDT
Unable to reproduce the NPE. 
The dataprocessor issue is being addressed by 187090
Comment 12 Paul Slauenwhite CLA 2009-06-30 13:25:56 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.
Comment 13 Paul Slauenwhite CLA 2009-06-30 13:52:13 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.