apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.68k stars 854 forks source link

Netbeans 15 - Clicking on "Open project..." hangs for long time #4673

Closed decadX closed 9 months ago

decadX commented 2 years ago

Apache NetBeans version

Apache NetBeans 15

What happened

When I click on "Open project..." the ide hangs. image

image

How to reproduce

Connect to a Private network (vpn) Create a mapped network drive on Windows Disconnect from the VPN Click on "File > Open a project..." Dialog takes very long (almost as much as Windows takes to determine if the mapped network drive is connected, if you have more than one network drives, takes more)

Do the same steps on Visual Studio Code, no delays - whether connected or not on the VPN.

Did this work correctly in an earlier version?

I think it work on Apache NetBeans 12.6

Operating System

Windows 10 x64

JDK

Java(TM) SE Runtime Environment (build 18.0.2.1+1-1)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Happens every day at least a few times. Not sure what its causing it. I have to kill the IDE 4-5 times before it opens. The projects folder is inside an Onedrive synced directory (if it matters)

Are you willing to submit a pull request?

No

Code of Conduct

Yes

lkishalmi commented 2 years ago

Well, Onedrive is known to affect file IO performance. Opening a project is quite IO intensive. I won't work with project on Network/Virtual drives Use other tools like version control systems to keep your work in sync.

It is also important to know what kind of projects are you talking about.

NetBeans 12.6 is kind of old, it also does not support Java 18, try to upgrade to NetBeans 15.

decadX commented 2 years ago

Hello @lkishalmi this isn't about opening an individual project and how long it takes, this is when you try to open the File Explorer dialog where you store your projects.

image

That dialog popup is what hangs. The screenshot is from Netbeans 15, on a 8-core, 64gb/SSD desktop PC. Each project's folder contains only the netbeans files, nbproject, the source is kept in another place. So its only 3-4 files in there.

I did some more digging and seems to be happening when I am NOT connected to a company VPN (where I have some mapped drives), if I connect to the VPN, its all ok.

So I have updated the issue with new replication steps. Doesn't happen on VSCode for example, so something going on with that explorer dialog.

lkishalmi commented 2 years ago

Then most probably it is a known issue that the File dialog is slow when there are broken links. If I remember well: broken links on your Desktop. That might be a Java bug. As myself is not a Windows user for 18 years, I can't really tell more.

hink084 commented 2 years ago

@decadX I've had the same problem. It occurs when opening any File Explorer dialog within NetBeans. I think what @lkishalmi is suggesting is to remove' any broken shortcuts (Windows: "Shortcuts", Linux: "Soft Links") from your desktop. This would include any shortcuts that may point to a location on a disconnected network share drive (ie when you're not connected to your VPN). This worked for me and seems to be the workaround for the issue.

' I believe you could also nest the broken links in a subdirectory on your desktop as opposed to outright deleting them.

It appears this same issue was reported in #3919.

claudio-tortorelli commented 1 year ago

I experienced the same with NB 16. As @lkishalmi and @hink084 said, I solved removing broken symbolic links from Desktop (for example placing them inside a Desktop subfolder)

TW2 commented 1 year ago

Hello everyone, I experienced the same issue (dialog are slow when open it). I have multiple partition and nas on my local network. I experienced the same thing when adding a JFileChooser directly in method with any project that needs a dialog. But I solved the problem in my projects when I preload dialog on constructor or ui premaking. The dialog works like a charm if you construct them a long time before, maybe a solution.

System : Windows 11, 128Gb RAM, 34Tb on multiple drive, 40Tb on NAS.

The problem appears when Oracle gives you the project 2023-05-10 10-18-09.mkv-muxed.zip

Hassan1305 commented 1 year ago

Hello everyone, I am another victim of the same bug on windows 10, I have been using Netbeans 13 but now even upgraded to Netbeans 17, I have tried most of the solutions suggested at different places, from changing configuration files to deletion of lock file, It seems like I have broken links problem, I removed all the shortcuts from the desktop as well but seems it is not working, the bug occurs when ever I try to open file or open a project, or when creating a new project I click browse to open window explorer, problem is somewhere in it. I have lot of resources and upon checking task manager, seems like there are free resources (system is not full), neither I am not even trying to open a bigger project of large size. Can I get more guide on how to fix these broken links. Seems like the links are doing the problem , I have tried to run the application from the installed folder as well, Netbeans-17/netbeans/bin/netabeans64.exe. Any help would be appreciated, I can do my work on linux on side as well, but still doing the comment so maybe someone else could get more guide if they encounter the same bug. Also this would solve my bug too. Thank you

warrenc5 commented 1 year ago

Please can you point me to "How to turn on more netbeans logging"

If I/we know what the IDE is "doing" I/we could at least try a few things first (other than just complain about the weather)

wenvinking commented 1 year ago

Software: Netbeans IDE 16 JDK: 1.8 x64 Specs:

I also have this problem and NO ONE, NO ONE is able to solve this problem on my laptop (it happens only on my laptop). EVEN MY LECTURER don't know how to handle this problem. This is very annoying.

I've tried to:

  1. Re-install netbeans 16
  2. Search for solutions on google & youtube (nothing works 'til now)
  3. Delete netbeans shortcut on my desktop (btw is this what u guys mean by broken links? doesn't work for me)

Can someone pls help, I have to wait for 2 minutes just to navigate projects T_T

warrenc5 commented 1 year ago

I was having similar annoying problems on net beans 18 - so I cloned (with git) and built (with maven) from master and now my IDE is running (fairly smoothly)

Is there anyway you could try to do that too?

warrenc5 commented 1 year ago

Now I'm getting the intermittent slowness again in dev with an old project group

I do have an annotation processor but I've disabled it when spotting the eclipselink option. I've tried disabling "compile on save", "maven incremental compile task", "auto compelete popups", "any look & feel options",

It feels like the pauses are random and random times - sort of like what I'd expect with a GC - but I have 4G heap and only using 2G - I know it still does GC - but everytime I go to type there's an uncomfortable 2-5 second pause. Especially if it's a statement block '{' break and then everything goes "wall of error" in red.

I'm using jVi editor plugin - I've tried disabling that too, but I couldn't use the default editor for some weird key mapping issue.

I've tried disabling as many plugins as possible.

If I tail the messages log in .netbeans/var/log/messages.log or watch it on the console.

I seem to get these quite frequently.

July 20, 2023 10:07:24 AM org.netbeans.modules.java.navigation.ElementScanningTask runImpl
INFO: Duplicate top level class: <error>
Miss elem: 146
Miss seg: 146
Hit elem: 146
lkishalmi commented 1 year ago

@warrenc5 It would be worth to do a self profiling. It is pretty easy to create a profile snapshot. Use the buttons right to the memory gauge!

warrenc5 commented 1 year ago

Ok - thanks for the suggestion, I started the profiling.

Didn't do to much CTRL-TAB switched the editor a few times and selected some code. Didn't get any noticeable pauses.

Then made a simple change and got a long pause. (Maybe about 4 seconds)

Stopped the profile and looked.

shot-2023-07-20_11-08-49

lkishalmi commented 1 year ago

Could you export this one and attach to this issue?

warrenc5 commented 1 year ago

Thank goodness for CTRL-SHIFT T (because I had previously closed the tab)

netbeans-profile-slowness-4673.zip

lkishalmi commented 1 year ago

I think some plugin (probably jVi) does some blocking on the AWT event queue. Based on this: image

Normally parsing tasks are executed in the background (as they should), but if you check the AWT and the parsing thread time are very close. AWT event thread should consume just a few hundred milliseconds max.

warrenc5 commented 1 year ago

I agree - I'll raise it with the plugin developer.

Sorry if I have hijacked this thread. I will endeavor to disable the jVi plugin and continue testing for slowness.

ermya commented 1 year ago

i have same problem, it takes time while opening any folder almost 30 sec, I even updated to the latest version, but it has no effect. I also used the profiler, but I didn't understand anything

ppppp

selfsampler.zip

lkishalmi commented 1 year ago

image

Seems a 24-35 seconds well spent on Network wait/discover.

ermya commented 1 year ago

Indeed, do you perhaps have any proposed solutions or strategies to mitigate this problem?

lkishalmi commented 1 year ago

Well, do not use/remove network drives, broken links on your desktop/home folder and your NetBeans project area. That's what others say. I have limited knowledge regarding that as I have no Windows around.

ermya commented 1 year ago

I asked ChatGPT 4, and suggested these solutions:

"The sun.awt.shell.Win32ShellFolder2.getLinkLocation[native] function is related to reading the filesystem, and if you're experiencing delays when you're opening projects or files, it does suggest that there's a bottleneck in NetBeans' interaction with your filesystem.

This could be due to a variety of reasons such as:

Slow Hard Drive: If your hard drive is slow or busy with other tasks, it may slow down the reading of the filesystem.

Large Project Files: If your projects are large or complex, or if there are a lot of files to load, it could take a significant amount of time to read them all.

Antivirus or Firewall: Sometimes, antivirus software or firewall settings can interfere with the IDE's access to the filesystem.

IDE or Plugin Issue: It might be an issue with NetBeans itself or one of its plugins. Some users have reported similar issues with various versions of NetBeans."

I checked all of them carefully -I do not have an antivirus -I did not install any plugins -All SSD drives are NVME type

I will try to find a way to solve the problem and if I succeed, I will write here. Anyway, thank you for your help

mbien commented 1 year ago

Indeed, do you perhaps have any proposed solutions or strategies to mitigate this problem?

I mean, as workaround it should be always possible to drag and drop folders/files into NetBeans without using the dialog.

Or open things via the Favorites window.

vindic commented 1 year ago

To complete the answers of this issue, in my case it was the Antivirus (Trend Micro Apex).

Unloading it, and Netbeans 19 with Windows 11 is working like a charm.

sfmarcius commented 1 year ago

Just to add my contribution... I'm getting this problem too... It takes 1min+ to the open dialog to appear.

What I noted is that when I disable the Network Adapter (stay offline), the problem goes away.

quachthekiet commented 1 year ago

i uninstalled the jdk and reinstalled the older jdk version and it worked correctly again

neilcsmith-net commented 10 months ago

Could be related to this won't-fix bug in the JDK given we have a security manager set - https://bugs.java.com/bugdatabase/view_bug?bug_id=8265446

coffeebeantraining commented 9 months ago

I installed Apache Netbeans 20 fresh install running jdk-21.0.2 and it's very slow when opening a project. Maybe consider rewriting Netbeans in C/C++ because the current imperative language is simply too slow. Please wait...forever :( image

mbien commented 9 months ago

Maybe consider rewriting Netbeans in C/C++ because the current imperative language is simply too slow.

I have to admit, this made me laugh :) The last time I heard something like this was probably in the late 90s.

anyway, this issue went off topic a few times and the original problem is described by the older issue #3919 I am going to add some information there and close this issue here as duplicate, feel free to subscribe to #3919.