Skip to content

feat: Do not serialize VaadinSession by default in development - #11304

Merged
pleku merged 12 commits into
masterfrom
keepauth
Jun 25, 2021
Merged

pleku merged 12 commits into
masterfrom
keepauth

Conversation

@Artur-

@Artur- Artur- commented Jun 22, 2021

Copy link
Copy Markdown
Member

Fixes #11151

@Artur-

Artur- commented Jun 23, 2021

Copy link
Copy Markdown
Member Author

Seems like this approach has a problem at least with Jetty. Jetty (in the included test) serializes the session after each request so after the first serialization, when sessionWillPassivate has been called, the VaadinSession is no longer found and the application does not work.

Artur- added a commit that referenced this pull request Jun 23, 2021
Avoids writing VaadinSession to the HTTP session when the controlling properties are set (devmode + parameter).
For implementation reasons, something must be serialized so only a boolean is written and these kind of
"not actually serialized" sessions are removed when loading them after deserialization.

Fixes #11151
@Artur-

Artur- commented Jun 23, 2021

Copy link
Copy Markdown
Member Author

Took another approach which skips serialization instead of removing it from the session

Avoids writing VaadinSession to the HTTP session when the controlling properties are set (devmode + parameter).
For implementation reasons, something must be serialized so only a boolean is written and these kind of
"not actually serialized" sessions are removed when loading them after deserialization.

Fixes #11151
@pleku
pleku requested review from denis-anisimov and pleku June 24, 2021 06:04

@pleku pleku left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to test with some other projects+servers too

@vaadin-bot vaadin-bot added +0.1.0 and removed +1.0.0 labels Jun 24, 2021
pleku
pleku previously approved these changes Jun 24, 2021

@pleku pleku left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with TomEE and it worked there too. Tried with Jboss/Wildfly but run into other issues and could not get to test hot deploy capabilities easily ...

@denis-anisimov are you going to take a look or not ?

@pleku

pleku commented Jun 24, 2021

Copy link
Copy Markdown

Also, maybe there should be a mention of this behavior in https://github.com/vaadin/docs/blob/latest/articles/guide/live-reload/index.asciidoc, can you make a PR there @Artur- ? Essentially I would just add a note that this behavior is there to make it easier to develop apps while keeping authentication features enabled, and that the behavior will not be the same for production apps.

@denis-anisimov

Copy link
Copy Markdown
Contributor

Immediate question: is it only targets the master version or it will be picked into other versions ?

@Artur-

Artur- commented Jun 24, 2021

Copy link
Copy Markdown
Member Author

Only master

@denis-anisimov

Copy link
Copy Markdown
Contributor

@denis-anisimov are you going to take a look or not ?

yes.

Is there any rush ?

@Artur-

Artur- commented Jun 24, 2021

Copy link
Copy Markdown
Member Author

Docs in vaadin/docs#584

denis-anisimov
denis-anisimov previously approved these changes Jun 24, 2021
@vaadin-bot

Copy link
Copy Markdown
Collaborator

SonarQube analysis reported 7 issues

  1. CRITICAL DefaultApplicationConfigurationFactory.java#L183: Define a constant instead of duplicating this literal "jar!/" 3 times. rule
  2. MAJOR VaadinService.java#L413: Rename "instantiator" which hides the field declared at line 192. rule
  3. MINOR VaadinService.java#L354: Replace this lambda with a method reference. rule
  4. MINOR VaadinService.java#L416: Remove this use of "init"; it is deprecated. rule
  5. MINOR VaadinService.java#L430: Remove this use of "init"; it is deprecated. rule
  6. MINOR VaadinSession.java#L550: Remove the literal "false" boolean value. rule
  7. INFO VaadinSession.java#L79: Do not forget to remove this deprecated code someday. rule

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with platform 21.0.0.alpha8. For prerelease versions, it will be included in its final version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow disabling serialization of VaadinSession and disable it by default

4 participants