Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

LCDS Lost Connection

Avatar

Level 1

when LCDS first starts, everything goes smoothly, however, after a long time of no activity, when user reload the page, the error message is returned, and says the data cannot be pulled, but the second time the user reload the page, everything goes fine again.

for me, it seems LCDS drop the database connection after no user pulls the data for a long period, does anyone else experience the same issue?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Are you using MySQL as your database? MySQL automatically drops idle connections after a set amount of time (See the wait_timeout setting: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout and also here: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html) If so, you can try increasing the wait_timeout value if there are extended intervals when no one accesses the server, or tweaking your connection properties to have it auto-reconnect.

Besides that, you can try configuring your pool to check connections before returning them. For e.g. on DBCP you can try the testOnBorrow/testWhileIdle settings. Note that testing a connection every time (on borrow) is expensive.

View solution in original post

4 Replies

Avatar

Correct answer by
Former Community Member

Are you using MySQL as your database? MySQL automatically drops idle connections after a set amount of time (See the wait_timeout setting: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout and also here: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html) If so, you can try increasing the wait_timeout value if there are extended intervals when no one accesses the server, or tweaking your connection properties to have it auto-reconnect.

Besides that, you can try configuring your pool to check connections before returning them. For e.g. on DBCP you can try the testOnBorrow/testWhileIdle settings. Note that testing a connection every time (on borrow) is expensive.

Avatar

Level 1

thanks for the reply.

that solution can work for me.

do you know if any error code or exception will be thrown(i am getting JDBC fail: null), so far i try to catch that event/exception so i can wait for a few seconds and re-try to pull the data.

Avatar

Former Community Member

I am not sure of the exact error code. Overall, I feel it would be better if you could configure your DB/Connection/Pool so that it never causes the exception to occur on the Java side...

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----