Puzzled !
I just got some exception from my MksPlugin,
Thing is, the source for this method (SandboxCacheImpl.getSandboxesIntersecting) is as follows, How can it ever return null ?
getSandboxesIntersecting(@NotNull final VirtualFile directory) {
Set result = new HashSet();
for (List infoList : new ArrayList>(sandboxByFolder.values())) {
for (MksSandboxInfo sandboxInfo : infoList) {
if (sandboxInfo.isSubSandbox) continue;
VirtualFile sandboxFile = sandboxInfo.sandboxPjFile;
if (sandboxFile == null) {
synchronized (lock) {
LOGGER.warn("SandboxInfo with NULL virtualFile !! removing from registered sandboxes");
infoList.remove(sandboxInfo);
addRejected(sandboxInfo);
}
} else if (VfsUtil.isAncestor(directory, sandboxFile, false)) {
result.add(sandboxInfo);
} else {
final VirtualFile sandboxParentFile = sandboxFile.getParent();
if (sandboxParentFile != null && VfsUtil.isAncestor(sandboxParentFile, directory, false)) {
result.add(sandboxInfo);
}
}
}
}
return result;
}
]]>
Please sign in to leave a comment.
Hello Thibaut,
We've received a number of similar exception reports, and as far as we can
see this is a HotSpot bug (which got worse in JDK 1.6.0_04). We inspected
the bytecode produced by our instrumentation, and weren't able to see any
problems with the generated code.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
I stumbled upon exactly the same problem in my code yesterday.
Even more puzzling: my return value is final and never can get null.
Dmitry, have you seen it reported on Sun's BugParade ? so that i can wath/vote for it ?
Hello Thibaut,
No, we don't yet have enough information for a specific report, other than
"it crashes sometimes in some cases".
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
the result variable seems to be (wrongly) GC'd
Thibaut wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
wow, if the GC starts garbagin local variables while their owning frame is still on the call stack, we're gonna see strange things !
Following code gets NPE eventually with JDK 7 ea according to blog (in
Russian)
http://blogs.sun.com/vmrobot/entry/%D0%BF%D0%BE%D0%BC%D0%BD%D0%B8%D1%82%D0%B5_%D0%BE%D0%B1_%D0%BE%D0%BF%D1%82%D0%B8%D0%BC%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D0%B8
import java.util.logging.*;
public class TestLogger {
static void testLogger(boolean provokeGC) {
String name = "TestLogger";
Logger logger = Logger.getLogger(name);
if (provokeGC)
System.gc();
LogManager.getLogManager().getLogger(name).log(Level.SEVERE,
"Logger works");
}
public static void main(String[] args) {
for (int i = 0; i < 20000; i++) {
System.out.println("Iteration: " + i);
// at this point testLogger method should be compiled
boolean provokeGC = i > 10000;
testLogger(provokeGC);
}
}
}
Thibaut wrote:
>>the result variable seems to be (wrongly) GC'd
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
thanks for the pointer, i managed to get the basics out of it thanks to google translate :)
I wonder if switching to a different garbage collector would help...
Bas
Maxim Mossienko (JetBrains) wrote:
>> I just got some exception from my MksPlugin,
>>
>>
>> Thing is, the source for this method (SandboxCacheImpl.getSandboxesIntersecting) is as follows, How can it ever return null ?
>>
> @NotNull >> public Set getSandboxesIntersecting(@NotNull final VirtualFile directory) { >> Set result = new HashSet(); >> >> for (List infoList : new ArrayList>(sandboxByFolder.values())) { >> for (MksSandboxInfo sandboxInfo : infoList) { >> if (sandboxInfo.isSubSandbox) continue; >> VirtualFile sandboxFile = sandboxInfo.sandboxPjFile; >> if (sandboxFile == null) { >> synchronized (lock) { >> LOGGER.warn("SandboxInfo with NULL virtualFile !! removing from registered sandboxes"); >> infoList.remove(sandboxInfo); >> addRejected(sandboxInfo); >> } >> } else if (VfsUtil.isAncestor(directory, sandboxFile, false)) { >> result.add(sandboxInfo); >> } else { >> final VirtualFile sandboxParentFile = sandboxFile.getParent(); >> if (sandboxParentFile != null && VfsUtil.isAncestor(sandboxParentFile, directory, false)) { >> result.add(sandboxInfo); >> } >> } >> >> } >> } >> return result; >> } >> ]]>good point, i was using -XX:+UseParallelGC
i'll try without it