Skip to content

Java 21 regression bug: in a .jsp, request.getUserPrincipal() returns null despite being logged in #241

Closed

Description

@cyril-briquet

When setting java21 in appengine-web.xml,
in a .jsp, the call request.getUserPrincipal() returns null despite being logged in.

Activity

  1. self-assigned this
    on Jul 2, 2024
  2. ludoch commented on Jul 2, 2024

    @ludoch
    Contributor

    Both prod and local server?

  3. cyril-briquet commented on Jul 2, 2024

    @cyril-briquet
    Author

    Local server yes; production server I haven't tried.

  4. cyril-briquet commented on Jul 2, 2024

    @cyril-briquet
    Author

    Both prod and local server?

    I've just tried on a prod server: the answer is yes, both indeed.

  5. added a commit that references this issue on Jul 3, 2024
  6. lachlan-roberts commented on Jul 3, 2024

    @lachlan-roberts
    Collaborator

    Opened PR #243 to fix this.

  7. ludoch commented on Jul 3, 2024

    @ludoch
    Contributor

    Code fix is now checked in.
    Will reach prod end of next week or next (due to 4rth of July break in US).
    Meanwhile, you can try following for the next few days https://github.com/GoogleCloudPlatform/appengine-java-standard/blob/main/TRYLATESTBITSINPROD.md from head (Sorry, Maven only, gradle contribution welcome).

  8. cyril-briquet commented on Aug 4, 2024

    @cyril-briquet
    Author

    Update: bug is fixed in local devserver, but not in production server

  9. ludoch commented on Aug 4, 2024

    @ludoch
    Contributor

    A bit strange as the code area for the fix also applies to prod... Maybe one thing to try first is to go to the admin console, app engine instances page and try to kill whatever running instance you see to force a restart?

    Restarts are not automatically done anymore...

  10. cyril-briquet commented on Aug 4, 2024

    @cyril-briquet
    Author

    Thanks for your rapid answer.

    As suggested, I went to the admin console, AE instances page and killed the one instance that was running (apparently, it always restarts automatically even before I try to access the app in production as a user).

    FWIW, here is the code that correctly displays the user's e-mail with the dev server and null with the prod server:

    <%= (request.getUserPrincipal() != null) ? request.getUserPrincipal().getName() : "null" %>

  11. ludoch commented on Aug 5, 2024

    @ludoch
    Contributor

    Thanks!
    Sorry about that, we believe 3d53db9 should address it. Tested only manually, looking for a prod e2e test...

  12. cyril-briquet commented on Aug 6, 2024

    @cyril-briquet
    Author

    test-files.txt

    Please find here as an attached file the source code of a test web app exercising the bug

  13. cyril-briquet commented on Sep 20, 2024

    @cyril-briquet
    Author

    Works for me: bug not observed any more on the production server.
    Thanks for the patches.

  14. added a commit that references this issue on Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions