Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-63

Incorrect startup order

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Abandoned
    • 8.2, 9.0
    • None
    • None
    • All

    Description

      As part of analyzing the freeze bug on startup, I've come across something I see as a problem in NB startup sequence.

      Basically I see this sequence in the Platform's main startup thread:

      1. @OnStart tasks from modules are spawned
      2. ProxySelector is registered
      3. WarmUp tasks are spawned
      4. Authenticator is registered

      So clearly, tasks that may perform network operations are started before network infrastructure (ProxySelector and Authenticator) has been initialized. In real-life it will be hit and miss which comes first.

      I've attached my analysis of the startup sequence as a PDF (in case anyone disagrees).

      My idea for a fix is along these lines:

      • I want to continue to allow @Startup tasks and WarmUp tasks to be launched early (as today), but a task must itself be aware if it needs network or UI initialization or whatever.
      • I want to create a new RunLevel. Currently the RunLevel feature is under-used in my experience. There's really only one RunLevel at the moment, namely the GuiRunLevel which is always executed last. (despite the name it applies both to GUI and headless scenario). So I would add an additional RunLevel, NetworkRunLevel, where network infra will be initialized. The new RunLevel will run before GuiRunLevel. This mimics what operating systems does and I believe this was also the original idea of the RunLevel feature.
      • Currently RunLevels are found by Lookup so that anyone can install their own RunLevel. I don't think this feature is used (it probably requires to be Friend), but it is nice and we should of course still cater for it.
      • Create a public interface where a task can wait for a given RunLevel to have executed. I'm thinking some kind of annotation or something.
      • Existing WarmUp tasks will need to be amended to clearly indicate at what RunLevel they can execute. (default will be that all RunLevels have executed). Module tasks (@OnStartup) will also need to be catered for.

      Ideas, comments, please. There may be simpler ways of solving the problem but we should really keep an eye on allowing to start tasks as early as we allow today (i.e. not make startup performance worse).

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            phansson phansson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment