-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
AccessLog error when setting more than one cookie in a response (Dropwizard 3.0.0) #7203
Comments
Hi @staffors. Logback uses the This wasn't a problem before because Logback simply uses a call to Due to the lack of support for Jetty 10.x, I've had to write a custom Dropwizard 4.x doesn't use the custom adapter any more because Logback supports Jetty 11.x in version 1.4.x. There the same code of Logback 1.2.x (used in Dropwizard 2.1.x) is executed again failing silently. |
So it feels like the underlying issue is really a shortcoming in the Logback interface, and just happens to be noticeable here because the DropwizardJettyServerAdapter uses a different mechanism to build the Map of headers. What do you think about the idea of updating DropwizardJettyServerAdapter to match the behavior of the Logback implementations? I understand your desire for correctness and to expose the header conflict, but it seems like matching the existing Logback behavior might be better in this instance? It certainly feels like it would be more convenient from a developer standpoint. |
My only concern is to build a correct implementation. Because the Logback interface doesn't support this, the only thing we can do is to warn about a conflict. If it's with an exception or a log message or something similar is just an implementation detail. Maybe we can change the implementation to gracefully fail with an additional warning of a suppressed header value. However, the best option would be a fix on Logback's side. I attempted that in this PR which is still unmerged. This doesn't solve the underlying problem, but would keep our implementation consistent between Dropwizard versions. As an alternative to the |
Ah, thanks for pointing me toward the classic request log, that appears to be a good workaround that will solve my immediate issue. I'm not sure what the best solution is otherwise. To me the exception seems a bit heavy handed in this situation, and a warn level log message might be better. But it also might not be worth the effort, particularly given that there are workarounds (classic request log) and that the issue doesn't seem to be a problem for most teams. Thanks for your work on this issue, I appreciate your thoughtful responses! I think I'll go ahead and close this issue as "not planned" but feel free to re-open it if you'd like a different resolution |
I'm upgrading our existing DropWizard app to v3.0.0 and now am seeing the following exception in our logs:
I'm not sure what aspects of our configuration are relevant, but we're running Java 17 and here are the libraries involved
And the relevant bit of our config.yml is
Does anyone have suggestions of how to work around this? Am I pulling in the wrong dependencies or anything?
The underlying issue appears to be this code fro DropwizardJettyServerAdapter.java:
It could be fixed by adding a merge function along the lines of this:
Of course that would lose values in the resulting map, but then we're losing them anyway with the exception. It looks like this code has changed significantly in DropWizard 4. I'm investigating upgrading to that, but we have a number of old Criteria queries that I think I'd need to rewrite, so that may be more work than I'd like to take on at the moment.
Any thoughts or advice would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: