Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase log level in ExceptionWebSocketHandlerDecorator [SPR-15537] #20096

Closed
spring-projects-issues opened this issue May 12, 2017 · 4 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Ayushya Devmurari opened SPR-15537 and commented

While working on an app which includes a module of spring-websocket. I did some changes in the code and I was having some hibernate exception in the back, but the exception is not getting printed/logged. I found out this while debugging the code. In this class "ExceptionWebSocketHandlerDecorator" in this public static method "tryCloseWithError", exception handling is there but logging is missing.

I have created a PR for this, please do the needful. Below is the link for PR.
#1424


Affects: 4.3.3

Referenced from: commits 9923675, df8412b

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

That catch block only really suppresses exceptions during the actual close attempt. Did you indeed get a Hibernate exception right there? Could you please share the stacktrace for it?

@spring-projects-issues
Copy link
Collaborator Author

Ayushya Devmurari commented

I agree with you, I should have give it a closer look, about catch block.

However I found this exception in ExceptionWebSocketHandlerDecorator, Below is the stack trace which was generated but couldn't find it in logs. Logs are set to debug mode.

[org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:296),
org.springframework.orm.hibernate5.HibernateExceptionTranslator.convertHibernateAccessException(HibernateExceptionTranslator.java:68),
org.springframework.orm.hibernate5.HibernateExceptionTranslator.translateExceptionIfPossible(HibernateExceptionTranslator.java:49),
org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59),
org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213),
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147),
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179),
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213),
com.sun.proxy.$Proxy57.getCandidateByEmail(Unknown Source),
org.opensource.myapp.communication.CallHandler.register(CallHandler.java:148),
org.opensource.myapp.communication.CallHandler.handleTextMessage(CallHandler.java:94),
org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43),
org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75),
org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:56),
org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:58),
org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:110),
org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42),
org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81),
org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:78),
org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:399),
org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:500),
org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:295),
org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:131),
org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:71),
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:185),
org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:198),
org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:96),
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:661),
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1519),
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1475),
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142),
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617),
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61),
java.lang.Thread.run(Thread.java:745)]

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

in this public static method "tryCloseWithError", exception handling is there but logging is missing.

I'm not sure what you mean. The first thing this method does is log the error.

However I found this exception in ExceptionWebSocketHandlerDecorator

Again not clear what you mean by "found". Did you put a break somewhere, where? Did you step through and how could it not log where the source link above shows clearly it is logging.

@spring-projects-issues
Copy link
Collaborator Author

Ayushya Devmurari commented

Thanks,
I agree with you that the first thing the method does is logging the error but if you see it I have to put my logger mode in debug mode, I think error should be printed irrespective of debug mode on or off.

Second thing, yes I did put a break point in my class from there I navigated to class "ExceptionWebSocketHandlerDecorator" and in this method "tryCloseWithError" I found that there is some exception, I "watch" the variable "exception" and while doing exception.printStackTrace() I found above stacktrace.

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.9 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants