Issue Details (XML | Word | Printable)

Key: GLASSFISH-14001
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anissa Lam
Reporter: Anissa Lam
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
glassfish

Creating Profiler in any config except server-config results in error

Created: 14/Oct/10 10:35 PM   Updated: 31/Jan/11 09:22 AM   Resolved: 31/Jan/11 09:22 AM
Component/s: admin_gui
Affects Version/s: 3.1
Fix Version/s: 3.1_b41 , not determined

Time Tracking:
Not Specified

File Attachments: 1. Java Source File JvmSettingsTest.java (9 kB) 31/Jan/11 08:04 AM - Anissa Lam
2. Text File server.log (27 kB) 28/Jan/11 11:03 PM - shaline
3. File server.log.ins1 (18 kB) 28/Jan/11 11:03 PM - shaline

Environment:

Operating System: All
Platform: All


Issuezilla Id: 14,001
Tags: 3_1-approved
Participants: Anissa Lam, ludo, shaline, sirajg and srinik76


 Description  « Hide

I have filed a similar bug, ie any changes to JVM will go to server-config.

To reproduce the problem:

  • copy server-config to 'TEST-config'
  • go to TEST-config -> JVM -> Profiler page
  • enter 'ABC' as the profiler name. click SAVE

You will see 'an error has occurred' without saying any reason.

Look at server.log, you will see there is an NPE:

[#|2010-10-14T22:34:40.817-
0700|SEVERE|glassfish3.1|org.glassfish.admingui|_ThreadID=105;_ThreadName=admin-thread-pool-
4848(7);|Exception Occurred:
java.lang.NullPointerException
at
org.glassfish.admingui.common.handlers.InstanceHandler.getJvmOptions(InstanceHandler.java:134)
at
org.glassfish.admingui.common.handlers.InstanceHandler.deleteJvmOptions(InstanceHandler.java:175)
at
org.glassfish.admingui.common.handlers.InstanceHandler.saveJvmOptionValues(InstanceHandler.java:1
50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



srinik76 added a comment - 14/Oct/10 11:30 PM

Assigning to myself


srinik76 added a comment - 15/Oct/10 12:04 AM

Fixed even delete profiler scenario.

Sending javaConfig/jvmProfiler_2.inc
Transmitting file data .
Committed revision 41755.


shaline added a comment - 28/Jan/11 05:47 PM

The bug is fixed for local-instance config, when the instance is not running. But when the "instance is running", either remote or local, the creation succeeds, but deletion throws java.lang.RuntimeException:
server.log has:
java.lang.reflect.InvocationTargetException while at tempting to process a 'command' event for 'deleteButton'.

But if I navigate back from the configurations/ins1-config/JVM options/Profiler and I see no profiler listed. So I try to create another profiler, I get the below Exception:
"An error has occurred
An error occurred during replication FAILURE: Command create-profiler failed on server instance remote-ins: remote failure: profiler exists. Please delete it first FAILURE: Command create-profiler failed on server instance ins1: remote failure: profiler exists. Please delete it first"


shaline added a comment - 28/Jan/11 11:03 PM

Attached DAS server.log, and instance server.log for reference.


Anissa Lam added a comment - 29/Jan/11 12:37 AM

Whether the instance is running or not, we pass the following endpoint and payload to delete the profiler:

endpoint: "http://localhost:4848/management/domain/configs/config/test-config/java-config/profiler"
payload: target=test-config

If the instance is stopped, it works fine.
If the instance is running, we are getting 400 status back.

(however, if this is DAS, then it works ok)

delete-profiler command doesn't takes operand.
Usage: asadmin [asadmin-utility-options] delete-profiler
[--target <target(default:server)>] [?|-help[=<help(default:false)>]]

Transfer to REST for investigation. I believe we are passing in correct info. If not, please let us know how to delete the profiler when the instance is RUNNING.


Anissa Lam added a comment - 29/Jan/11 09:25 AM

I looked at this more.
We are using the generic method to delete the config element, (profiler) by providing the target. When the target is running, this is deleted from DAS domain.xml, but doesn't get deleted from the instance domain.xml, because

Caused by: java.lang.RuntimeException: DELETE http://localhost:4848/management/domain/configs/config/TTT-config/java-config/profiler?target=TTT-config returned a response status of 400

So, this causes the profiler element out-of-sync. I believe this is a bug in the framework.

However, there is the 'delete-profiler' command which works correctly. So, maybe using generic delete is not suppose to work in this case ?? I don't know. However, most element can be deleted using generic without issue.

I change the code to use 'delete-profiler' command, and everything works fine. I am taking this issue back.
When i did more testing and have the code ready, will send out for approval and review.

If Ludo/Tom wants to look at why the generic delete doesn't work, i can open up a new bug, but that fix can wait till after 3.1.


Anissa Lam added a comment - 29/Jan/11 09:33 AM

1. How bad is its impact? (Severity)
pretty servere, as it prevents user to delete profiler when the instance is running. This also causes domain.xml out-of-sync.

2. How often does it happen? (Frequency)
everytime when trying to delete a profiler of a running instance.

3. How much effort is required to fix it? (Cost)
1 day

4. What is the risk of fixing it? (Risk)
Small.

5. Does a work around for the issue exist? Can the workaround be reasonably employed by the end user?
Either use the CLI 'delete-profiler' command, or user can stop the instance first, delete the profiler and restart the instance.

6. If the issue is not fixed should the issue and its workaround (if applicable) be described in the Release Notes?
yes.

7. How long has the bug existed in the product?
Looking at the cause, it probably is there since we add clustering support in GUI.

8. Do regression tests exist for this issue?
no. I am going to add devtest to test this together with the code i will checkin.

9. Which tests should QA (re)run to validate the fix did not destabilize GlassFish?
The standard automated test they run.

10. When will a tested fix be ready for integration?
Before Monday nightly build.


ludo added a comment - 29/Jan/11 09:57 AM

I though we moved all generic delete and update to CLI commands to make sure replication is working...
I guess we are missing one?
Yes, moving to the real cli command works.
On REST side we would need to map it to the DELETE under this resource...


ludo added a comment - 29/Jan/11 10:15 AM

Hum...delete-profiler is mapping in the config bean directly so we use this mapping....
But it is defined in the javaconfig bean:

@Configured
@RestRedirects({ @RestRedirect(opType = RestRedirect.OpType.POST, commandName = "create-profiler"), @RestRedirect(opType = RestRedirect.OpType.DELETE, commandName = "delete-profiler") })
public interface JavaConfig extends ConfigBeanProxy, Injectable, PropertyBag, JvmOptionBag {

Wrong place?


Anissa Lam added a comment - 29/Jan/11 02:14 PM

Here is the svn diff. I have tested different scenario:

  • das
  • stopped instance
  • running instance
    create/delete/edit jvm profiler all works correctly.

There is a call of gf.getEntityAttrs() which is suppose to get the default value of the profiler attributes. But it was using the wrong endpoint, and actually there is no way to get the default attribute of profiler if the profiler doesn't exist. So, i remove that and just hardcoded 'enabled' to true. This is the only attribute that has default anyway.

Index: src/main/resources/javaConfig/jvmProfiler_1.inc
===================================================================
— src/main/resources/javaConfig/jvmProfiler_1.inc (revision 44781)
+++ src/main/resources/javaConfig/jvmProfiler_1.inc (working copy)
@@ -52,18 +52,17 @@
<!beforeCreate
setSessionAttribute(key="javaConfigTab" value="profiler");
getRequestValue(key="configName" value=>$page{configName} default="server-config");
-

  • setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}");
    +
    + urlencode(value="#{pageSession.configName}" encoding="UTF-8" result="#{pageSession.encodedConfigName}");
    + setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.encodedConfigName}");
    setPageSessionAttribute(key="selfUrl", value="#{pageSession.parentUrl}/java-config");
    setPageSessionAttribute(key="rest-api" value="true");
    - gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}.json", valueMap="#{pageSession.valueMap}");
    -
    setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/javaConfig/serverInstProfiler.jsf");
    setPageSessionAttribute(key="childType" value="profiler");
    setPageSessionAttribute(key="confirmDeleteMsg" value="$resource{i18nc.msg.JS.confirmDeleteProfiler}");
    setPageSessionAttribute(key="profilerUrl", value="#{pageSession.parentUrl}/java-config/profiler");
    setPageSessionAttribute(key="createProfilerUrl", value="#{pageSession.parentUrl}/java-config/create-profiler");
    - setPageSessionAttribute(key="deleteProfilerUrl", value="#{pageSession.parentUrl}/java-config/profiler");
    + setPageSessionAttribute(key="deleteProfilerUrl", value="#{pageSession.parentUrl}/java-config/profiler/delete-profiler");
    gf.checkIfEndPointExist(endpoint="#{pageSession.profilerUrl}/jvm-options" exists="#{pageSession.edit}");

    if(#{edit}) {
    @@ -71,6 +70,11 @@
    getJvmOptionsValues(endpoint="#{pageSession.profilerUrl}/jvm-options.json" result=>$attribute{tableList});
    gf.listCombine(list="#{null}" list2="$attribute{tableList}", result="#{pageSession.origList}");
    }
    + //there is no way to get the default value of profiler when one doesn't exist. just hard code 'enabled' to true
    + if ("#{edit}=false")
    Unknown macro: {+ createMap(result="#{pageSession.valueMap}");
    + mapPut(map="#{pageSession.valueMap}" key="enabled" value="true");+ }

    setPageSessionAttribute(key="onlyUseAttrs" value={"name", "target", "classpath", "enabled","nativeLibraryPath"})
    setPageSessionAttribute(key="convertToFalseList" value={"enabled"});
    />

sirajg added a comment - 31/Jan/11 08:10 AM

Changes look good.


Anissa Lam added a comment - 31/Jan/11 09:22 AM

Fix checked into both Trunk and 3.1 branch.
Trunk: rev# 44795
3.1 branch: rev# 44796

-------------------------
Project: glassfish
Repository: svn
Revision: 44795
Author: anilam
Date: 2011-01-31 16:59:25 UTC
Link:

Log Message:
------------
GLASSFISH-14001. Fix JVM Profiler issue with running server. change to use delete-profiler command instead of using generic config bean function.
Manual test and dev test added.
Reviewer: Siraj
Approved by Nazrul

Revisions:
----------
44795

Modified Paths:
---------------
trunk/v3/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/JvmSettingsTest.java
trunk/v3/admingui/common/src/main/resources/javaConfig/jvmProfiler_1.inc
trunk/v3/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/StandaloneTest.java