Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-892

Calling session-scoped components from session initialized observer goes into infinite loop

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.1.4.Final
    • 1.1.1.Final
    • Scopes & Contexts
    • None

    Description

      Given a session scoped component

      @SessionScoped
      public class Pinger implements Serializable
      {
      	public void ping()
      	{
      	};
      }
      

      and a session initialized observer calling it

      public class Observer
      {
      	@Inject
      	Pinger pinger;
      
      	public void newSession(@Observes @Initialized HttpSession s)
      	{
      		pinger.ping();
      	}
      }
      

      We go off into an infinite loop. Since Pinger doesn't exist, it is created and placed in the session scoped beanstore, which creates a session and fires off the observer. I'm not sure why the session isn't considered created at this point. This is bordering on feature since I think the result would be the same if servlet listeners would be used. Perhaps this could be worked around int the event bridge somehow so that the firing would be prevented if we're already handling the session created event...

      Attachments

        Activity

          People

            ajustin@redhat.com Ales Justin
            nickarls Nicklas Karlsson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: