vahidhedayati / grails-wschat-plugin

Grails websocket chat Plugin provides a multi-chat room add-on to an existing grails based site. provides: Private Messaging/WebRTC/Offline PM + room booking/reservations. Websocket TicTactoe. Add Live Chat to your Grails application
http://grails.org/plugin/wschat
Apache License 2.0
22 stars 10 forks source link

wschat3.0.4, have erros on the console #11

Closed hanyou closed 8 years ago

hanyou commented 8 years ago

dependency compile "org.grails.plugins:wschat:3.0.4"

but when i visit http://localhost:8080/wschat,have erros on the console:

| Running application... objc[25094]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. Grails application running at http://localhost:8080 in environment: development ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unique index or primary key violation: "UK_84OX4JBM5KCJ8E0VPQPV82C5T_INDEX_8 ON PUBLIC.CHATPERMISSIONS(NAME) VALUES ( /* key:1 / 32, 0, TIMESTAMP '2015-11-02 14:39:02.64', TIMESTAMP '2015-11-02 14:39:02.64', 'user')"; SQL statement: insert into chat_permissions (id, version, date_created, last_updated, name) values (null, ?, ?, ?, ?) [23505-176] org.springframework.dao.DuplicateKeyException: Hibernate operation: could not execute statement; SQL [n/a]; Unique index or primary key violation: "UK_84OX4JBM5KCJ8E0VPQPV82C5T_INDEX_8 ON PUBLIC.CHATPERMISSIONS(NAME) VALUES ( / key:1 _/ 32, 0, TIMESTAMP '2015-11-02 14:39:02.64', TIMESTAMP '2015-11-02 14:39:02.64', 'user')"; SQL statement: insert into chat_permissions (id, version, date_created, last_updated, name) values (null, ?, ?, ?, ?) [23505-176]; nested exception is org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "UK_84OX4JBM5KCJ8E0VPQPV82C5T_INDEX_8 ON PUBLIC.CHATPERMISSIONS(NAME) VALUES ( / key:1 _/ 32, 0, TIMESTAMP '2015-11-02 14:39:02.64', TIMESTAMP '2015-11-02 14:39:02.64', 'user')"; SQL statement: insert into chat_permissions (id, version, date_created, last_updated, name) values (null, ?, ?, ?, ?) [23505-176] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.grails.orm.hibernate.GrailsHibernateTemplate.convertJdbcAccessException(GrailsHibernateTemplate.java:623) at org.grails.orm.hibernate.GrailsHibernateTemplate.convertHibernateAccessException(GrailsHibernateTemplate.java:611) at org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:202) at org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:142) at org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:112) at org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.performSave(AbstractHibernateGormInstanceApi.groovy:254) at org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.save(AbstractHibernateGormInstanceApi.groovy:179) at org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:76) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:112) at org.grails.datastore.gorm.GormEntity$Trait$Helper$save$3.call(Unknown Source) at grails.plugin.wschat.ChatPermissions.save(ChatPermissions.groovy) at grails.plugin.wschat.ChatPermissions.save(ChatPermissions.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210) at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1123) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:919) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:902) at org.grails.datastore.gorm.GormStaticApi.internalFindOrCreate(GormStaticApi.groovy:681) at org.grails.datastore.gorm.GormStaticApi.findOrSaveWhere(GormStaticApi.groovy:672) at org.grails.datastore.gorm.GormStaticApi$findOrSaveWhere.call(Unknown Source) at org.grails.datastore.gorm.GormEntity$Trait$Helper.findOrSaveWhere(GormEntity.groovy:690) at org.grails.datastore.gorm.GormEntity$Trait$Helper$findOrSaveWhere$1.call(Unknown Source) at grails.plugin.wschat.ChatPermissions.findOrSaveWhere(ChatPermissions.groovy) at grails.plugin.wschat.ChatPermissions$findOrSaveWhere.call(Unknown Source) at grails.plugin.wschat.auth.WsChatAuthService.$ttaddUser(WsChatAuthService.groovy:46) at grails.plugin.wschat.auth.WsChatAuthService$_addUser_closure2.doCall(WsChatAuthService.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at groovy.lang.Closure.call(Closure.java:426) at groovy.lang.Closure.call(Closure.java:442) at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:93) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:90) at grails.plugin.wschat.auth.WsChatAuthService.addUser(WsChatAuthService.groovy) at grails.plugin.wschat.auth.WsChatAuthService.$ttvalidateLogin(WsChatAuthService.groovy:68) at grails.plugin.wschat.auth.WsChatAuthService$_validateLogin_closure4.doCall(WsChatAuthService.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at groovy.lang.Closure.call(Closure.java:426) at groovy.lang.Closure.call(Closure.java:442) at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:93) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:90) at grails.plugin.wschat.auth.WsChatAuthService.validateLogin(WsChatAuthService.groovy) at grails.plugin.wschat.auth.WsChatAuthService$validateLogin$2.callCurrent(Unknown Source) at grails.plugin.wschat.auth.WsChatAuthService.$tt__connectUser(WsChatAuthService.groovy:158) at grails.plugin.wschat.auth.WsChatAuthService$_connectUser_closure9.doCall(WsChatAuthService.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at groovy.lang.Closure.call(Closure.java:426) at groovy.lang.Closure.call(Closure.java:442) at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:93) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:90) at grails.plugin.wschat.auth.WsChatAuthService.connectUser(WsChatAuthService.groovy) at grails.plugin.wschat.auth.WsChatAuthService.connectUser(WsChatAuthService.groovy) at grails.plugin.wschat.auth.WsChatAuthService$connectUser$0.call(Unknown Source) at grails.plugin.wschat.ChatUtils.verifyAction(ChatUtils.groovy:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:922) at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1259) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1212) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174) at grails.plugin.wschat.WsChatEndpoint.handleMessage(WsChatEndpoint.groovy:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBase.onMessage(PojoMessageHandlerWholeBase.java:80) at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:393) at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:494) at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:289) at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:130) at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:60) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:203) at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:198) at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:96) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "UK_84OX4JBM5KCJ8E0VPQPV82C5T_INDEX_8 ON PUBLIC.CHATPERMISSIONS(NAME) VALUES ( / key:1 */ 32, 0, TIMESTAMP '2015-11-02 14:39:02.64', TIMESTAMP '2015-11-02 14:39:02.64', 'user')"; SQL statement: insert into chat_permissions (id, version, date_created, last_updated, name) values (null, ?, ?, ?, ?) [23505-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)

hanyou commented 8 years ago

happen on first user login

vahidhedayati commented 8 years ago

But then it works after that ?

If that is the case, I have noticed this behaviour under grails 3 and it only as you say for the very first attempt of triggering chat.

After this all is ok ? as in any other attempts ?

I was testing something similar with livechat and old method of chat.

It may be related to back end client socket connection since the new method with no bot didn't cause this issue where as old one did.

So long as it is the very first attempt and afterwards all is OK, then I am aware of that and in the bigger scope of things until I figure out the exact cause and find a fix, just ensure you trigger a test connection to the chat site after launching a grails 3 chat plugin site.

I will look into this when I have some spare time

vahidhedayati commented 8 years ago

Problem was:

org.grails.datastore.gorm.GormEntity$Trait$Helper.findOrSaveWhere(GormEntity.groovy:690)
at org.grails.datastore.gorm.GormEntity$Trait$Helper$findOrSaveWhere$1.call(Unknown Source)
at grails.plugin.wschat.ChatPermissions.findOrSaveWhere(ChatPermissions.groovy)
at grails.plugin.wschat.ChatPermissions$findOrSaveWhere.call(Unknown Source)
at grails.plugin.wschat.auth.WsChatAuthService.$tt__addUser(WsChatAuthService.groovy:46)

Still occuring in 3.0.8 should be fixed in the next release when I finish all the changes. This was as suspected due to bot.

After investigating further it turns out two requests to add admin group simultaneously occurred. This being actual user and bot. In this next version being 3.0.9 (unreleased) I have moved the segment that adds group right above any interaction starts and problem appears to be no longer 1. Please can you retest this when I release 3.0.9

vahidhedayati commented 8 years ago

Can you please test 3.0.9 please have a read of

https://github.com/vahidhedayati/grails-wschat-plugin/wiki/3.0.9---must-have-configuration

before upgrading and let me know if you still are facing any issues with that