question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow disabling serialization of VaadinSession and disable it by default

See original GitHub issue

Description of the feature

When you are using authentication in your application, the authentication information is by default stored in the HTTP session. If you use Spring dev tools during development then one every Java change, the server will be restarted. When this happens, the session is serialized and then deserialized again. If the whole application is serializable, the session will be retained and you will stay logged in. However, in most cases the Flow application is not serializable as you can very easily create code that causes serialization of the component tree to fail. When serialization of the Flow application fails, the authentication info will not be serialized either but instead the whole session will be thrown away.

Actual behavior

The development workflow is

  1. Start app
  2. Login and navigate to the view you want to modify
  3. Make code changes
  4. Auto reload kicks in
  5. Login and navigate to the view
  6. Check if you did the correct changes

Expected behavior

The workflow should be

  1. Start app
  2. Login and navigate to the view you want to modify
  3. Make code changes
  4. Auto reload kicks in
  5. Check if you did the correct changes

Suggested solution

Add a parameter called serializeVaadinSession with a default value of false.

When serializeVaadinSession is false, the VaadinSession and related locks that are stored in the HTTP session are not serialized when the session is serialized. Everything else in the HTTP session is serialized.

When serializeVaadinSession is explicitly set to true in the project, use the current behavior.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
knoobiecommented, Jun 4, 2021

^The same could be done in vaadin with the newly created vaadin-dev-server and development-mode - setting serializeVaadinSession to false, the opposite of the spring-boot-devtools configuration to make the development smooth without interfering with the production-mode later on, as both spring-boot-devtools and vaadin-dev-server should not be present in production environments.

1reaction
plekucommented, Jun 4, 2021

I like the idea of not “changing the current default”, but instead having vaadin-dev-server set the serializeVaadinSession=false.

It would probably (?) make it work in a backwards compatible manner for other usage than just Spring - with still retaining the default behavior for production mode (serialize), as long as people update their projects to exclude the vaadin-dev-server artifact for production build.

When serializeVaadinSession is false, the VaadinSession and related locks that are stored in the HTTP session are not serialized when the session is serialized. Everything else in the HTTP session is serialized.

@Artur- Do you know a nifty way to do or does it require checking the property value in writeObject ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make it optional to serialise VaadinSession #11921 - GitHub
If we want to disable UI serialization by default, a better option would be to set the property in new projects.
Read more >
Class VaadinSession
Everything inside a VaadinSession should be serializable to ensure compatibility with schemes using serialization for persisting the session data.
Read more >
Enabling and disabling DAG serialization | Cloud Composer
You can enable and disable DAG serialization in new and existing environments ... is by default turned on in Airflow 2.x and you...
Read more >
Serialized Form (vaadin-server) - javadoc.io
Used to temporarily allow duplicates in the list. ... Disabled by default. ... VaadinPortletSession extends VaadinSession implements Serializable ...
Read more >
Disable Java deserialization completely - serialization
A simple way to prevent deserialization is to define an agressive deserialization filter (introduced in Java 9 via JEP 290).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found