jruby / warbler

Warbler chirpily constructs .war files of your Ruby applications.
Other
883 stars 204 forks source link

Warble on Win10 stalls without any information #517

Closed K4sku closed 5 months ago

K4sku commented 2 years ago

When I run any warbler command nothing happens. Console just says on task. It's repetive on 2 windwos 10 machines. One is my daily computer, other was a clean win10 install.

Steps:

  1. install Jruby 9.3.4.0 x64 with executable from https://www.jruby.org/download
  2. install Java 18.0.1.1 x64 with OpenJDK
  3. install gem with gem install warbler
  4. navigate to project root folder
  5. run warble config or warble
  6. Here it stops. I can hear fans spinning up, tasks manager is showing ram and CPU usage, but it never finishes. I have left task running overnight.

Any clues what could be the issue here? How I can debug it?

K4sku commented 2 years ago

I have found problem.

in file jruby-9.3.4.0\lib\ruby\gems\shared\gems\warbler-2.0.5\lib\warbler\traits\bundler.rb while loop in line 48 is infinite on windows. loop while checking presence of bunlder.gemspec file

Current loop:

while ! full_gem_path.join('bundler.gemspec').exist?
  full_gem_path = full_gem_path.dirname
  # if at top of the path, meaning we cannot find bundler.gemspec, abort.
  if full_gem_path.to_s =~ /^[\.\/]$/   ###############################
    warn("Unable to detect bundler spec under '#{spec.full_gem_path}'' and its sub-dirs")
    exit
  end
end

Line with hashes is exit condition that is never met on Windows system. Windows Root path will look like C:/ on local I have added another exit condition that addreses it: if full_gem_path.to_s =~ /^[\.\/]$/ || full_gem_path.to_s =~ /^[a-zA-Z]:\/$/

Another problem is that jruby installer / zip / jar does not have bundler.gemsec file at all. The gem comes with exe folder and two files in it. I do not know what's up with that.

PS F:\download\jruby-dist-9.3.4.0-bin\jruby-9.3.4.0\lib\ruby\gems\shared\gems\bundler-2.2.29> ls . -r

    Directory: F:\download\jruby-dist-9.3.4.0-bin\jruby-9.3.4.0\lib\ruby\gems\shared\gems\bundler-2.2.29

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          23.03.2022    08:41                exe

    Directory: F:\download\jruby-dist-9.3.4.0-bin\jruby-9.3.4.0\lib\ruby\gems\shared\gems\bundler-2.2.29\exe

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-----          23.03.2022    08:40           1476 bundle
-----          23.03.2022    08:40             96 bundler

I have reinstalled it with jgem install bundler -v 2.2.29

After that is worked flawlessly. Should I make PR with these changes?

AndyObtiva commented 2 years ago

I encountered the warble command freeze issue on Windows 10 with jruby 9.3.6.0 on JDK 18 (even after I downgraded my bundler to 2.2.29).

The issue does not occur in jruby 9.3.4.0 on JDK 16.

This is holding up the ability to package Glimmer DSL for SWT applications on Windows with jruby 9.3.6.0 on JDK18.

In the meantime, I am downgrading users to jruby 9.3.4.0 and JDK 16 on Windows as a workaround.

AndyObtiva commented 2 years ago

@kares does the warbler gem need an update given the latest changes in bundler, jruby 9.3.6.0, and JDK 18? I am curious to know your opinion after you try to reproduce this issue on Windows 10.

AndyObtiva commented 2 years ago

I have reinstalled it with jgem install bundler -v 2.2.29

After that is worked flawlessly

That fix worked for me too. Apparently, the freezing is related to the fact that the bundler gem included in JRuby does not have a gemspec (if I understood correctly).

Another fix was to simply install the latest bundler:

jgem install bundler

I included that fix in Glimmer DSL for SWT v4.24.1.3, so now it works on Windows 10 with JRuby 9.3.6.0 and JDK 18. That is because it now automatically installs the latest bundler upon scaffolding a new application.

Should I make PR with these changes?

@K4sku , the code changes you mentioned were not needed for me to resolve the warbler issue. By installing a bundler with a gemspec, the problem resolved itself of its own. Also, there is an existing PR (https://github.com/jruby/warbler/pull/494) that will take that lib\warbler\traits\bundler.rb if condition code out altogether as it was apparently an old hack that is no longer needed if I understand correctly from reading that PR.

@deivid-rodriguez Is this a good time to finally finalize and merge this PR? https://github.com/jruby/warbler/pull/494

@headius Should this warbler freezing issue be fixed in the next JRuby version by ensuring that a gemspec exists within the included bundler? That seems like the simplest fix I could think of to this problem. After all, not having a gemspec is not only a bit abnormal as it does not match the installed bundler v2.2.29 gem (if installed manually, it has a gemspec and it works), but it also breaks the expectations of warbler.

deivid-rodriguez commented 2 years ago

@deivid-rodriguez Is this a good time to finally finalize and merge this PR? https://github.com/jruby/warbler/pull/494

I don't have much time at the moment, but I rebased it and I'll have a look at CI. Your understanding is correctly. The code should not be needed and knowing it actually causes issues should be another motivation to remove it.

deivid-rodriguez commented 2 years ago

I rebased my PR and added a few things.

Still getting two spec failures, which I need to have a look at.

For starters I think #521 and #520 can be merged right away.