BashSupport-Pro / bashsupport-pro

Public issue tracking for BashSupport Pro. This is a plugin, which provides advanced support for Bash scripts for JetBrains IDEs.
https://www.bashsupport.com
46 stars 2 forks source link

PHPStorm is Freezing and Crashing but only when Bash Support Pro is enabled #163

Closed gridpane closed 5 months ago

gridpane commented 5 months ago

PhpStorm 2024.1.1 Build #PS-241.15989.102, built on April 23, 2024 Runtime version: 17.0.10+1-b1207.14 aarch64 M1 Max 64GB RAM

Started today...

It just freezes up...

Sometimes it throws an error window saying "too complex"

The project is pretty huge shell project, single entry point with about 40 sourced in files and libs...

But it seems there is too much for the application to handle with all the features

Have ticket open with Jetbrains with logs. But I can work on my project if I disable this plugin.

But working on this project without this tool...is unthinkable...

Not sure what I can provide...

jansorg commented 5 months ago

Thanks for reporting! Even though I have pretty extensive performance tests in place, it's possible that especially the number of or the deep nesting of sourced files is causing a problem.

Could you do the following to help me track down the bug:

Thanks! I'd definitely like to fix this :smile:

jansorg commented 5 months ago

Could you also provide a few hints on your setup, please?

Possible workarounds (after collecting the logs and CPU data above :smile:):

Thanks!

gridpane commented 5 months ago

I will email the logs and diagnostics shortly.

The code is not opensource, but its available. I can add you to our private gitlab. I will follow up with that in the email

There is no YouTrack issue, just private support ticket.

I don't have any CPU profiling available, only an activity monitor which doesn't show much... it just freezes too... the entire app freezes for like 100seconds at a time, every time I type...

Screenshot 2024-05-18 at 02 11 09

Project is Bash

I am not using the user-defined shell libraries yet, I really wanted to start, since it looks perfect for a project like this, just need to figure out how to incorporate their usage... this repo is pushed up and onto around 8K servers. not fully clear how if I removed the sourcing from the main entry point this would work... something like a github action to inject?

Pardon my ignorance, I just saw them when I was digging around trying to get this figured...

Only the top level file sources the other files... mostly... lol... some of the development scripts that are out have something like this:

caller=$(caller)
if [[ ${caller} == "0 NULL" ]]; then
  # shellcheck source=../main.sh
  . "$(dirname "${BASH_SOURCE[0]}")../main.sh"
  # shellcheck source=ext.sh
  . "$(dirname "${BASH_SOURCE[0]}")ext.sh"
  # shellcheck source=misc.sh
  . "$(dirname "${BASH_SOURCE[0]}")misc.sh"
fi

So we can call them directly, while working... im going to remove this stuff, see if it helps...

This particular script /lib/stack.sh is 7K lines.... but its not the longest by far...

I did disable the inspections, but ill see about removing the extended analysis

Cheers

gridpane commented 5 months ago

Ah.. also, i upped the memory to 8GB... but in activity monitor when it freezes I am not seeing untoward cpu or memory usage.... nothing near that.

jansorg commented 5 months ago

The code is not opensource, but its available. I can add you to our private gitlab. I will follow up with that in the email

Thanks! You can use mail@bashsupport.com for the account.

I don't have any CPU profiling available, only an activity monitor which doesn't show much... it just freezes too... the entire app freezes for like 100seconds at a time, every time I type...

That's very bad :disappointed: but (hopefully) fixable

I am not using the user-defined shell libraries yet, I really wanted to start, since it looks perfect for a project like this, just need to figure out how to incorporate their usage... this repo is pushed up and onto around 8K servers. not fully clear how if I removed the sourcing from the main entry point this would work... something like a github action to inject?

user-defined shell script libraries are to help BashSupport Pro and to avoid dozens or hundreds of source "$file" lines spread around a project. It's especially useful for projects which do for f in lib/*.sh; do source "$f"; done. The script has to still source the files, of course, to provide it to Bash when it's executed.

Only the top level file sources the other files... mostly... lol... some of the development scripts that are out have something like this:

caller=$(caller)
if [[ ${caller} == "0 NULL" ]]; then
  # shellcheck source=../main.sh
  . "$(dirname "${BASH_SOURCE[0]}")../main.sh"
  # shellcheck source=ext.sh
  . "$(dirname "${BASH_SOURCE[0]}")ext.sh"
  # shellcheck source=misc.sh
  . "$(dirname "${BASH_SOURCE[0]}")misc.sh"
fi

This shouldn't make it worse.

This particular script /lib/stack.sh is 7K lines.... but its not the longest by far... I did disable the inspections, but ill see about removing the extended analysis

Did this start to happen after upgrading to BashSupport Pro 4.x or are the freezes probably unrelated to this?

jansorg commented 5 months ago

The missing "Capture CPU data" is probably due missing plugin https://plugins.jetbrains.com/plugin/7819-performance-testing. You should see this when you install it.

But because you'll provide the sources, I'll take care of this and to get this fixed.

gridpane commented 5 months ago

user-defined shell script libraries are to help BashSupport Pro and to avoid dozens or hundreds of source "$file" lines

yeah that makes sense... I can get away from all these:

caller=$(caller)
if [[ ${caller} == "0 NULL" ]]; then
  # shellcheck source=../main.sh
  . "$(dirname "${BASH_SOURCE[0]}")../main.sh"
  # shellcheck source=ext.sh
  . "$(dirname "${BASH_SOURCE[0]}")ext.sh"
  # shellcheck source=misc.sh
  . "$(dirname "${BASH_SOURCE[0]}")misc.sh"
fi

Did this start to happen after upgrading to BashSupport Pro 4.x or are the freezes probably unrelated to this?

Freezes started to happen earlier today...

I hadn't updated anything... recently... usually when something like this happens I update PHPstorm to latest, checked, there was an update, so I updated, it said Bash Support Pro also updated...

But the issue persisted... or even got worse...

But I've tried on the last three releases of PHPStorm, no joy... wiped everything down etc...

I just tried with all inspections disabled and with extended analyis disabled too, same issue.

I've invited you to the gitlab repo, let me know if there is anything else I can do...

It really is unthinkable to work in Bash without this tool lol

gridpane commented 5 months ago

Crazy thing...

It's only happening with me when i start writing tests...

if [

And it freezes....

Cases, for loops, whiles, no issues...

I am resorting to cutting and pasting tests in... that is fine... weird...

gridpane commented 5 months ago

Honestly Joachim is incredible with his support for this.

Tested a fix within a day, and I can work again.

This is only compatible for 2023.3

https://www.bashsupport.com/download/bashsupport-pro-signed-4.1.2.233-20240517-eap.zip

And likely most users won't see this issue.

jansorg commented 5 months ago

Please note that this is a preview build, the final 4.1.2 builds will be available soon on the JetBrains Marketplace.

jansorg commented 5 months ago

Version 4.1.3 is now available with a fix.