Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » NEON Initialization Failed
NEON Initialization Failed [message #1743566] Fri, 16 September 2016 12:40 Go to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
since several years we are very happy with scout.
But also we know for years with scout and rap that getUserId infrequently was failing.
Until Mars the solution was ClientSyncJob.getCurrentSession().getUserId() and SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject() and verifing or not using SharedContextVariable.

But since NEON leads missing of userId as SharedContextVariable to this error. And controlling and setting on ServerSession.loadSession does not grip anymore.

2016-09-16 10:48:44,175 ERROR [ajp-nio-8009-exec-2] org.eclipse.scout.rt.ui.html.json.JsonMessageRequestHandler - Error while initializing UI session - MDC[principal=Hommel, httpUri=/getn1015/json, cid=ju8tg4sp7yq/1]
org.eclipse.scout.rt.platform.util.Assertions$AssertionException: Assertion error: No userId available [user=Hommel, calling-thread=ajp-nio-8009-exec-2, job=Starting ClientSession [sessionId=efefccd6-a636-4065-bdd0-ca6aadfc6e82]]
	at org.eclipse.scout.rt.platform.util.Assertions.fail(Assertions.java:580)
	at org.eclipse.scout.rt.platform.util.Assertions.assertNotNull(Assertions.java:87)
	at org.eclipse.scout.rt.client.clientnotification.ClientSessionRegistry.checkSession(ClientSessionRegistry.java:105)
	at org.eclipse.scout.rt.client.clientnotification.ClientSessionRegistry.sessionStarted(ClientSessionRegistry.java:98)
	at org.eclipse.scout.rt.client.clientnotification.ClientSessionRegistry.sessionChanged(ClientSessionRegistry.java:223)
	at org.eclipse.scout.rt.client.AbstractClientSession.fireSessionChangedEvent(AbstractClientSession.java:646)
	at org.eclipse.scout.rt.client.AbstractClientSession.start(AbstractClientSession.java:328)
	at org.eclipse.scout.rt.client.session.ClientSessionProvider$1$1.call(ClientSessionProvider.java:81)
	at org.eclipse.scout.rt.client.session.ClientSessionProvider$1$1.call(ClientSessionProvider.java:1)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.context.RunContextRunner$1.call(RunContextRunner.java:42)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.security.SubjectProcessor$1.run(SubjectProcessor.java:47)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
	at org.eclipse.scout.rt.platform.security.SubjectProcessor.intercept(SubjectProcessor.java:43)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
	at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:121)
	at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:38)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask$1.call(JobFutureTask.java:100)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:160)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
	at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:54)



This never happens after fresh deployment but after time frequently, hence it becomes a problem.
Apps runing on Ubuntu 14.04, Apache Tomcat/8.0.36, java-8-oracle/jre1.8.0_66-b17.

A rapid response would be appreciated.

Rüdiger
Re: NEON Initialization Failed [message #1743888 is a reply to message #1743566] Tue, 20 September 2016 12:32 Go to previous messageGo to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi,

i am a bit irritated about what is going on in this forum?
Today it is exactly 6 years ago that i placed a question in this forum and until now got not a single response.
That was ok because my job is to solve problems.

And now i have this problem in two production apps, meaning it's urgend.
Ok also here i hope that the solution, by replacing ClientSessionRegistry, will lead to peace again.

But i would appreciate to at least discuss what could be done.

Rüdiger
Re: NEON Initialization Failed [message #1743889 is a reply to message #1743888] Tue, 20 September 2016 12:42 Go to previous messageGo to next message
Matthias Zimmermann is currently offline Matthias ZimmermannFriend
Messages: 202
Registered: June 2015
Senior Member
hi rudiger

all people answering to questions do this not as their main job but on the side or in private. sometimes the time lags between questions and answers are very short, and at times they are long. in that sense it's ok that you let people know that you are in need for urgent support. this might help to get an answer more quickly and i'll try to get your question answered.

however: if you need sla's and guaranteed answering times then this is bad good match with the free offering of this forum and would rather be a case for professional support (which we can offer too).

does that make sense to you?

best regards
matthias
Re: NEON Initialization Failed [message #1743902 is a reply to message #1743889] Tue, 20 September 2016 13:50 Go to previous messageGo to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi Matthias,

i'm very pleased with your answer and understand exactly your opinion and thanks for informing me about your professional support.

But in this case i was wondering that no one else in the forum had this problem, also the weakness of SharedValues got this attention in NEON.
I know that the problem depends on special conditions in terms of sporadically and short login times, because we have apps without this problem.
For that my problem first and foremost is not only to find a solution but to discuss it.

By the way i'm not sure if this is a bug or at least not a good idea to assert on getUserId and bring this frightening reaction directly to the user, also meanwhile a session is running in tomcat and a bean call to the server works without problems.


Rüdiger
Re: NEON Initialization Failed [message #1743914 is a reply to message #1743902] Tue, 20 September 2016 15:06 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
Hi Rüdiger

Can you try the following:

In your client session:

  @Override
  protected void execLoadSession() {
    initializeSharedVariables();
    ...


Since the userid is set in the serversession and synchronized to the client, a first server call must be made during initialization.

I hope this helps.

Regards,
Judith
Re: NEON Initialization Failed [message #1743917 is a reply to message #1743914] Tue, 20 September 2016 15:32 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
It might also be a problem on the server.
- Can you check, if in AbstractServerSession.assignUserId() always a userid is assigned? maybe add a log entry in your AccessControlService.
- Are you using a single server or a cluster?
Re: NEON Initialization Failed [message #1743983 is a reply to message #1743917] Wed, 21 September 2016 09:51 Go to previous messageGo to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi Judith,

thanks for your time you are spending on this problem.

We use single server.

Problematic are two apps on the same server with often sporadically and short logins and i think you could be right with the server problem.

In one of the apps i added BEANS.get(IPingService.class).ping("") on last friday as first action in Client.loadSession but also replaced ClientSessionRegistry without assert getUserId and since then it seems ok. But this is cosmetic.

From the other app you get some code that i think it is essential for this.

the Client looks like this
	@Override
	protected void execLoadSession() {
		CODES.getAllCodeTypes("de.psgl.getn.shared");
		getUserData();
		setDesktop(new Desktop());
	}

	private UserData getUserData() {
		if (userMap == null)
			userMap = new HashMap<String, UserData>();
		UserData data = null;
		String u = getCurrentUserId();
		if (!((u == null) || u.isEmpty())) {
			data = userMap.get(u);
			if (data == null) {
				try {
					data = BEANS.get(IAdminUserProcessService.class).getDataByUniqueKey(u);
					if (data != null) userMap.put(u, data);
				} catch (ProcessingException e) {
					LOG.error("getUserData", e);
				}
			}
		}
		if (data == null)
			data = new UserData(u == null ? "" : u);
		return data;
	}

	public String getCurrentUserId() {
		String s = getUserId();
		if (s == null) {
			s = BEANS.get(IAccessControlService.class).getUserIdOfCurrentSubject();
		}
		return s;
	}


and the Server like this

	@Override
	protected void execLoadSession() {
		getCurrentUserId();
		LOG.info("created a new session for {}", getUserId());
		validateVPN();
	}
	
	private UserSessionData getUserData() {
		if (userMap == null)
			userMap = new HashMap<String, UserSessionData>();
		UserSessionData data = null;
		String u = getCurrentUserId();
		if (!((u == null) || u.isEmpty())) {
			data = userMap.get(u);
			if (data == null) {
				try {
					data = BEANS.get(IUserSessionService.class).getUserSessionData(u);
					if (data != null) userMap.put(u, data);
				} catch (ProcessingException e) {
					LOG.error("getUserData", e);
				}
			}
		}
		if (data == null)
			data = new UserSessionData(u == null ? "" : u);
		return data;
	}

	public String getCurrentUserId() {
		String userId = getUserId();
		LOG.info("getCurrentUserId from getUserId() 1. " + userId);
		String userId2 = BEANS.get(IAccessControlService.class).getUserIdOfCurrentSubject();
		if (!userId.equals(userId2)) {
			LOG.info("getCurrentUserId from getUserIdOfCurrentSubject() 2." + userId2);
			userId = userId2;
			// setSharedContextVariable("userId", String.class, userId); this line is normally active but was not on logged situation
		}
		return userId;
	}	


The logs from the day are complete so that you can inspect what was going on.
Because of the situation in the morning i redeployed at 10:26.

You have to know that the apps are running for years in this manner with rap and migrated allways to the new mode with no problems.
The code above is the result of experience that after a timeout of the ClientSession in tomcat often the information of wrong user appeared.

You can see in the server log that after a fresh installation ClientSession's start with an own ServerSession.
But after time getUserId is not getUserIdOfCurrentSubject and last but not least there is only the getUserData call from the ClientSession.
In tomcat you can see only one ServerSession.

For me it looks like the session handling on server becomes tied or with other words it could have something like a leak.

Rüdiger

  • Attachment: logs.zip
    (Size: 70.36KB, Downloaded 33 times)
Re: NEON Initialization Failed [message #1744033 is a reply to message #1743983] Wed, 21 September 2016 15:01 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
This does not look good.
A user should never get the session of another user.

How do you do the authentication?
Re: NEON Initialization Failed [message #1744039 is a reply to message #1744033] Wed, 21 September 2016 15:57 Go to previous messageGo to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi Judith,

that was also my first idea three weeks ago, but meanwhile i'm sure that is not the reason.

But ok i use Database CredentialVerifier.
First and until now in a very stable app we use it with bean call to the server.
Verification works always with success. But i do my job for more than 30 years and hence i tested different opportunities.
So in this apps database configs were verified and tomcat jndi and meanwhile plain jdbc with a connection per signon is used.

By the way today i deployed also in the second app a version with ping at ClientSession.execLoadSession,
replace of ClientSessionRegistry and updating SharedContextVariable userId in ServerSession when neaded.
And until now it is running like a charm with a ServerSession per ClientSession.

Don't you think it is at time that you have a look at your code.
What i have learned in those years the best model has to prove in reality.

As additional information when server is in this disastrous condition with only one ServerSession we realised that there is a only working user and no other can signin.
If he signsoff an other user and only this one can signon. This pitiable server can only be terminated.

My thanks for your engagement.

Rüdiger

[Updated on: Wed, 21 September 2016 16:31]

Report message to a moderator

Re: NEON Initialization Failed [message #1744046 is a reply to message #1744039] Wed, 21 September 2016 18:02 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
Hi Rüdiger

We tried to find the problem by looking at the code, but we do not understand yet, how this could happen.
In our own product we do not have the problem described by you.

Can you provide more details about your AccessControlService? Did you overwrite any of AbstractAccessControlService.getUserIdOfCurrentSubject and AbstractAccessControlService.getUserId(Subject subject)?

Judith
Re: NEON Initialization Failed [message #1744100 is a reply to message #1744046] Thu, 22 September 2016 10:41 Go to previous messageGo to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi Judith,


here the code in shared

public class AccessControlService extends AbstractAccessControlService<String> {

	@Override
	protected String getCurrentUserCacheKey() {
		return getUserIdOfCurrentUser();
	}

	@Override
	protected PermissionCollection execLoadPermissions(String userId) {
		return null;
	}
}


here in server

@Replace
public class ServerAccessControlService extends AccessControlService {

	@Override
	protected Permissions execLoadPermissions(String userId) {
		Permissions permissions = new Permissions();
		permissions.add(new RemoteServiceAccessPermission("*.shared.*", "*"));

		// TODO [rrk]: Fill access control service
		permissions.add(new AllPermission());
		return permissions;
	}
}



I do not understand much from what is going on in your system, but i like to use it.
Being used to find a solution in my own code and now have to do changes in your's was the real reason i come out of my peacefull working life.

I have following theory.
In our stable apps user work continuously and a timeout is rare, but in the problematic apps they come only few and for short and without signing off correctly.
We now the described problem for years and it is a case of SharedContextVariables, because you can see that the principal seems to be always correct.
I my eyes this is a concept for a statefull connection and i think this is easier with Swing.

Like i have come to know your company in the first place was working with Swing as client.
But we did it as soon as practicable with RAP, because we use Scout mainly as a frontend for our host system IBMi.
In Swing a timeout like in tomcat nearly never happens, perhaps a blue screen.

What is a new problem in NEON comes with the ServerSession handling.

I know this is not a technical solution but don't have the time to become an expert for your code and it is only what i think and would follow to test.

Hoping you have good luck and bringing me back a Scout with that i can sleep again(in the night).


Rüdiger
Re: NEON Initialization Failed [message #1744498 is a reply to message #1744100] Tue, 27 September 2016 13:01 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
Hi Rüdiger

You can only install a single scout UI war file on one tomcat server. For the server war files, there are no restrictions.

This is because we are using a single cookie store per JVM for the session lookup: See org.eclipse.scout.rt.shared.servicetunnel.http.MultiSessionCookieStore.
Can you please try this and tell us if it solves your problem?

Regards,
Judith
Re: NEON Initialization Failed [message #1744508 is a reply to message #1744498] Tue, 27 September 2016 14:29 Go to previous messageGo to next message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi Judith,

this is a very interesting information.

Indeed we thought about splitting the server but because of other reasons.
With the last patches everthing is running, but i know that this was not the right way.
Therefore i will initiate the splitting and report as soon as possible.

Thank you very much for your efforts.

Rüdiger
Re: NEON Initialization Failed [message #1748757 is a reply to message #1744508] Mon, 28 November 2016 12:38 Go to previous messageGo to next message
Luka Cavic is currently offline Luka CavicFriend
Messages: 25
Registered: August 2014
Junior Member
Hi, I have the same problem.

Some tips for resolving?
Re: NEON Initialization Failed [message #1748764 is a reply to message #1748757] Mon, 28 November 2016 13:22 Go to previous message
Ruediger Rensinghoff-Kranen is currently offline Ruediger Rensinghoff-KranenFriend
Messages: 9
Registered: September 2016
Junior Member
hi Luka,

meanwhile we follow the guideline from Judith and deploy only one Scout NEON Client in a tomcat server. For me now this is the straight running way. But you can also have a look on what i did before to get it run.


Rüdiger
Previous Topic:scout + springdata jpa
Next Topic:Dynamic add column to table
Goto Forum:
  


Current Time: Fri Aug 18 14:33:40 GMT 2017

Powered by FUDForum. Page generated in 0.10022 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software