Svatopluk Dedic created NETBEANS-6305:
-----------------------------------------

             Summary: ProjectManager.find() return null for project dir - race 
between Git and Projects
                 Key: NETBEANS-6305
                 URL: https://issues.apache.org/jira/browse/NETBEANS-6305
             Project: NetBeans
          Issue Type: Bug
          Components: projects - Generic Infrastructure, versioncontrol - Git
            Reporter: Svatopluk Dedic
            Assignee: Jaroslav Tulach
         Attachments: git-project-race1.png

I was trying to write some gradle projects tests using NbModuleSuite – the plan 
was to create a simpel gradle project (just buildscript), then open it as a 
project and inspect.

To my surprise, calls like FileObject.createAndOpen or 
FileObject.getOuputStream() write (inside FS Atomic Action) resulted in the 
project directory not being recognized at all ! When I tried to debug the 
situation, a stop in the debugger (just a single thread) caused the project to 
be found magically.

It turned to be a race between Git module (the workdir is created inside the 
source tree managed by git) and the Project system: Git module runs as 
extension to filesystems even inside FS Atomic Action (shown on a pictured 
stacktrace from debugger) and executes {*}FileOwnerQuery{*}{*}.findOwner{*} on 
the to-be-project directory before the buildscript is even created. The result 
of *not being a project* is then cached - and the cache is reset asynchronously 
when/after the project file is created.

But the test manages to call ProjectManager.findProject sooner, while the cache 
still holds the negative result.

One of the screenshots shows a debugger that stopped in a situation when the 
script file has been already created (a message in the output window), but 
project manager call invoked *after* the creation does not find a project. 
Uncommenting the m.invoke() line in HACK section will fix the situation - 
caches must be reset.

The other screenshot is a debugger stopping when the to-be-project directory is 
first inspected, showing that the directory's  is yet empty.

// cc: [~entlicher] 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to