Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1059036 - Portlet in Dashboard is broken for the first access
Portlet in Dashboard is broken for the first access
Status: VERIFIED
Product: JBoss Enterprise Portal Platform 6
Classification: JBoss
Component: Portal (Show other bugs)
6.1.1
Unspecified Unspecified
unspecified Severity high
: ER03
: 6.2.0
Assigned To: Juraci Paixão Kröhling
Tomas Kyjovsky
6_2 Triage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-28 22:18 EST by Toshiya Kobayashi
Modified: 2015-07-24 05:13 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
When more than one concurrent request reached a new dashboard, the first request to reach the server was still persisting the newly created dashboard while the second tried to retrieve it. This caused the second request to get an exception, and the first access to the dashboard could possibly have shown the portlet as broken. The fix flushes the JCR immediately after the dashboard is created, which persists the dashboard, and ensures the second request can always find the newly-created dashboard.
Story Points: ---
Clone Of:
: 1059053 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
dashboard_issue_01.png (104.63 KB, image/png)
2014-01-28 22:19 EST, Toshiya Kobayashi
no flags Details
dashboard_issue_02.png (120.81 KB, image/png)
2014-01-28 22:20 EST, Toshiya Kobayashi
no flags Details
debugger log 6.2.0.ER3 (4.26 KB, text/x-log)
2014-06-13 10:10 EDT, Tomas Kyjovsky
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker GTNPORTAL-3497 Major Closed Portlet in Dashboard is broken for the first access 2015-07-26 20:24:40 EDT

  None (edit)
Description Toshiya Kobayashi 2014-01-28 22:18:14 EST
Description of problem:

If you configure a richfaces portlet in dashboard template, the portlet may break for the first access by a newly created user.

Version-Release number of selected component (if applicable):

6.1.1.ER01

How reproducible:

Not always (once in a few tries). You can constantly reproduce it by using debugger.

Steps to Reproduce:

[easy test]

1. Build and deploy jsf2-rf4-hello-world-portlet quickstart
2. Edit gatein/gatein.ear/portal.war/WEB-INF/conf/portal/user/template/user/pages.xml

<page-set
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_5 http://www.gatein.org/xml/ns/gatein_objects_1_5"
    xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_5">

  <!-- The default dashboard page -->
  <page>
    <name>Tab_Default</name>
    <title>Tab_Default</title>
    <portlet-application>
      <portlet>
        <application-ref>jsf2-rf4-hello-world-portlet</application-ref>
        <portlet-ref>jsf2Rf4HelloWorldPortlet</portlet-ref>
        <preferences/>
      </portlet>
      <access-permissions>Everyone</access-permissions>
      <show-info-bar>false</show-info-bar>
      <show-application-state>true</show-application-state>
    </portlet-application>
  </page>

</page-set>

3. Start JPP
4. Login as root
5. [Application Registry]->[Import applications]
6. Create a user (e.g. john)
7. Logout
8. Login as john
9. Access to Dashboard

Actual results:

- You will see the following ERROR message in server side

11:15:18,639 ERROR [exo.jcr.component.core.JDBCStorageConnection] (http-/127.0.0.1:8080-5) Node add. Database error: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "JCR_IDX_IPSYSTEM_PARENT ON PUBLIC.JCR_IPSYSTEM(PARENT_ID, NAME, I_INDEX, I_CLASS, VERSION DESC)"; SQL statement:
insert into JCR_IPSYSTEM (ID, PARENT_ID, NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,1,?,?) [23505-168]

or

12:01:40,837 ERROR [org.exoplatform.portal.config.NewPortalConfigListener] (http-/127.0.0.1:8080-4) An Exception occured when creating the Portal Configuration. Exception message: Attempt to insert context EntityContext[state=ObjectStatus[status=TRANSIENT],mapper=EntityMapper[class=class org.gatein.mop.core.api.workspace.UserSite,typeName=mop:usersite]] as an existing child with name mop:cccc child of node /production/mop:workspace/mop:usersites: org.chromattic.api.DuplicateNameException: Attempt to insert context EntityContext[state=ObjectStatus[status=TRANSIENT],mapper=EntityMapper[class=class org.gatein.mop.core.api.workspace.UserSite,typeName=mop:usersite]] as an existing child with name mop:cccc child of node /production/mop:workspace/mop:usersites


- You will see that a select box is broken in the portlet (See dashboard_issue_01.png)
- If you refresh the browser, the portlet will be recovered but then you will see a popup "This portlet does not exist anymore, please refresh your browser" (See dashboard_issue_02.png). Kinda weird.

Expected results:

Dashboard and its portlet are displayed without an issue

Additional info:

[test with a debugger]

After step 8 in "Steps to Reproduce:",

- Set breakpoints at:
-- org.exoplatform.portal.application.PortalRequestHandler [line: 217] - processRequest(PortalRequestContext, PortalApplication)	
-- org.exoplatform.portal.application.UserSiteLifeCycle [line: 68] - onStartRequest(Application, PortalRequestContext)	
- Access to Dashboard
- The first request (Thread A) stops at UserSiteLifeCycle line 68. DataStorage cannot find PortalConfig so UserPortalConfigService.createUserSite() is called. It should persist the PortalConfig to JCR but *it's not committed yet*.
- Resume Thread A with debugger
- Thread A stops at PortalRequestHandler line 217. Portal responded to browser but JCR is not committed yet.
- Several requests (Thread B, C,...) from browser come into UserSiteLifeCycle line 68. Then "Step Over" Thread B to proceed 1 line. DataStorage cannot find PortalConfig yet and returns null so UserPortalConfigService.createUserSite() will be called.
- Resume Thread A with debugger
- Turn off all breakpoints
- Resume all threads with debugger
Comment 1 Toshiya Kobayashi 2014-01-28 22:19:30 EST
Created attachment 856908 [details]
dashboard_issue_01.png
Comment 2 Toshiya Kobayashi 2014-01-28 22:20:02 EST
Created attachment 856909 [details]
dashboard_issue_02.png
Comment 3 Toshiya Kobayashi 2014-01-28 22:32:51 EST
As I explained in "Additional info:", the root problem seems that Portal responds to browsers before JCR commit. To fix this particular issue, delaying (or letting wait for a lock) the subsequent threads would help.

Richfaces is not a mandatory condition but it sends multiple accesses for the first access so it's convenient to reproduce.

Thanks to https://issues.jboss.org/browse/GTNPORTAL-2072 , we don't see NoSuchDataException in RHJP 6.1.1.ER01 but still have this issue.
Comment 5 Juraci Paixão Kröhling 2014-05-27 06:07:19 EDT
As I still cannot reproduce, nor QA, I sent a patched JAR to Toshiya by email, to see if this fixes the issue. If so, I'll send a PR with the change, which is a similar solution as for BZ 1080249 .
Comment 6 Juraci Paixão Kröhling 2014-05-28 04:47:25 EDT
PR sent, as Toshiya confirmed that the fix seems to work: https://github.com/gatein/gatein-portal/pull/866
Comment 7 Peter Palaga 2014-06-02 09:29:15 EDT
https://github.com/gatein/gatein-portal/pull/866 was merged in upstream
Comment 8 Tomas Kyjovsky 2014-06-13 10:09:55 EDT
I couldn't reproduce the issue on 6.1.1.ER1 or 6.2.0.ER3 with or without debugger.
Comment 9 Tomas Kyjovsky 2014-06-13 10:10:58 EDT
Created attachment 908593 [details]
debugger log 6.2.0.ER3
Comment 10 JBoss JIRA Server 2015-07-24 05:13:56 EDT
Juraci Paixão Kröhling <jpkroehling@redhat.com> updated the status of jira GTNPORTAL-3497 to Closed

Note You need to log in before you can comment on or make changes to this bug.