Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glmmer "package[msi]" command results in JRuby 9.3.6.0 StackOverFlow error. #24

Closed
jayczech23 opened this issue Aug 5, 2022 · 36 comments

Comments

@jayczech23
Copy link
Contributor

Desktop (please complete the following information and make sure it matches Glimmer Pre-Requisites before reporting an issue):

  • CPU Architecture [e.g. x86_64 or AArch64]

x86_64

  • OS [e.g. Linux Ubuntu 20.04.1 LTS]:

Windows 10 Pro

  • Java Version [e.g. JDK 16.0.2]:

java 18.0.2

  • JRuby Version [e.g. jruby-9.3.1.0]:

jruby 9.3.6.0 (2.6.8)

  • Glimmer Libraries/Versions [e.g. glimmer 2.4.1 / glimmer-dsl-swt 4.21.2.0]:

4.24.1.1

Describe the issue

Wanted to report an error I am experiencing upon executing glimmer package[msi] commands to build an msi on Windows.

Gist:

Error packaging MSI with glimmer

A strange behavior I have seen is if I let the batch job run to completion, at times it will generate an MSI which can be successfully installed, but when I try to run it, it never opens the application. I can successfully run the app using glimmer run however.

@jayczech23 jayczech23 changed the title glmmier "package[msi]" command results in JRuby 9.3.6.0 StackOverFlow error. glmmer "package[msi]" command results in JRuby 9.3.6.0 StackOverFlow error. Aug 5, 2022
@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 5, 2022

Wow! you're stumbling on the strangest issues.

This one seems to be caused by a recent upgrade to bundler, which is causing warbler to freeze in an infinite loop when running the warble command (preventing packaging from completing): jruby/warbler#517

In the meantime, I noticed that MSI packaging works just fine on Windows 10 with JDK 16 and JRuby 9.3.4.0 (it always works for me). I updated the README to downgrade the requirements on Windows for now until that strange issue with warbler on JRuby 9.3.6.0/JDK18 is resolved.

Otherwise, sometimes launching JRuby applications on Windows 10 is a bit slow. Just be patient. A packaged app should start within 20 seconds max (but, probably within 10 seconds or less).

On Mac ARM64 machines, JRuby apps now start in 2.5 seconds only, which is incredible, and totally resolves any slow startup times for JRuby on that platform. It would be awesome if that were to happen on all platforms eventually, but right now only Mac ARM64 machines have the special fast M1 and M2 processors that Apple built recently.

In any case, let me know if packaging works for you on Windows 10 with JDK 16 and JRuby 9.3.4.0. And, if so, please close the issue (I'll handle the warbler issue separately).

@jayczech23
Copy link
Contributor Author

Still seeing the same issues after updating the following:

java version:

java 16.0.2 2021-07-20

JRuby version:

After upgrading I tried running glimmer package[msi] and got the following error that is pretty similar to the original:

Error After Downgrade GIST

jruby 9.3.4.0 (2.6.8)

@AndyObtiva
Copy link
Owner

So, I have an older JDK 16 / JRuby 9.3.4.0 setup that works on Windows 10. I did not try to reinstall them. I wonder if the latest patch revisions of them have bugs.

I’ll try to reinstall and let you know how it goes.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 6, 2022

One question I could ask in the meantime is what version of bundler do you have? If it’s newer than 2.2.19, which comes with jruby I believe, then I would advice you to uninstall your version and stick to the default bundler that comes with jruby. That might work.

@jayczech23
Copy link
Contributor Author

Thanks @AndyObtiva

I just checked bundle version with bundle --version and showing

2.2.29

@jayczech23
Copy link
Contributor Author

I will try to install version 2.2.19 of bundler and try packaging again.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 6, 2022

Sorry. That’s the version I meant. No need to install a new one. The recommendation was to uninstall any newer version than the default one that comes with JRuby. Seems that’s what you have, so we’re good there.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 6, 2022

I noticed you did an abort on the glimmer packaging task. Was that after you saw the stack overflow (which is caused by an infinite loop in the juwelier gem code), or did you see it after you hit control C on the keyboard because it was taking too long?

@jayczech23
Copy link
Contributor Author

Oh yes I interrupted with Ctrl-C after seeing the StackOverflow error.

@AndyObtiva
Copy link
Owner

Do you know roughly how long it took before you saw the stack overflow error?

@jayczech23
Copy link
Contributor Author

It was pretty immediate after running glimmer package[msi]

@AndyObtiva
Copy link
Owner

Interesting. That’s different from the issue I encountered with JDK18 and JRuby 9.3.6.0, which was a freeze (it hangs for a long time, seemed indefinite) right when warbler starts.

@jayczech23
Copy link
Contributor Author

yeah I just verified that the error shows up immediately after running glimmer package[msi], it seems to be now hung on the following:

C_3a_.jruby_minus_9_dot_3_dot_4_dot_0.lib.ruby.gems.shared.gems.juwelier_minus_2_dot_4_dot_9.lib.juwelier.RUBY$method$git_base_dir$0(C:/jruby-9.3.4.0/lib/ruby/gems/shared/gems/juwelier-2.4.9/lib/juwelier.rb:163)
org.jruby.dist/org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:139)
Tasks: TOP => gemspec:generate => version_required
(See full trace by running task with --trace)
Locking gem jar-dependencies by downloading and storing in vendor/jars...
lock_jars --vendor-dir vendor/jars
Installing gem 'ruby-maven' . . .
Installing gem 'ruby-maven-libs' . . .

using maven for the first time results in maven
downloading all its default plugin and can take time.
as those plugins get cached on disk and further execution
of maven is much faster then the first time.


-- jar root dependencies --

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 6, 2022

Did it at least generate config/warble.rb inside the project? It is supposed to do so the first time you run the glimmer package command.

@jayczech23
Copy link
Contributor Author

Oh yes that was generated

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 6, 2022

Ok, some potential good news. The infinite loop repeating line in juwelier is complaining about git. Are you missing git as a prerequisite? You need to install git for windows including git bash.

This is the link glimmer dsl for SWT mentions in pre-requisites for installing it: https://git-scm.com/download/win

@jayczech23
Copy link
Contributor Author

Confirmed I do have git installed via Powershell:

PS C:\Users\cechj\Development\dads-converter-ruby-main> git --version
git version 2.37.1.windows.1

@AndyObtiva
Copy link
Owner

Does the scaffolded project have a “.git” directory? Also, can you run “git log” and see a history ?

@jayczech23
Copy link
Contributor Author

Nope I don't see any git initialization files, except for a .gitignore.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 7, 2022

Ok, that’s the issue. It’s sending Juwelier into an infinite loop.

Run “git init” and then verify you have a “.git “ directory, then run git status to double check git is working.

Afterwards, re-run “glimmer package[msi]”.

If it doesn’t work, try to make one commit to the local git repo with all files and then run the packaging command again.

@jayczech23
Copy link
Contributor Author

Nice!

Initializing git repo seems to have made some progress, no longer seeing the immediate StackOverflow error.

Currently on the Generating JAR with Warbler... step.

@jayczech23
Copy link
Contributor Author

FYI it's still on Generating JAR with Warbler step

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 7, 2022

Huh..it seems you’re now encountering the issue I saw (warbler hanging)

could you please share config/warble.rb? I wanna see if it got generated correctly.

@AndyObtiva
Copy link
Owner

In any case, one thing you can try is to delete config/warble.rb after sharing it, and then rerun the packaging command. It should generate it again, and perhaps correctly this time since it won’t encounter the stackoverflow issue. Let me know if it works then or if it gets stuck.

@jayczech23
Copy link
Contributor Author

Just noticed it might be using 2 jruby instances:

Generating JAR with Warbler...
c:\jruby-9.3.4.0\bin\warble
c:\jruby-9.3.4.0\bin\warble.bat
c:\jruby-9.3.6.0\bin\warble
c:\jruby-9.3.6.0\bin\warble.bat

config/warble.rb:

https://gist.github.com/jayczech23/643b509e6e8f61395229b7f83fd6e383

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 7, 2022

Oh yeah. You need to go to your windows env and disable the other JRuby in the path env vars. You can delete and save in a notepad for the future to restore if you later want to

@jayczech23
Copy link
Contributor Author

Okay just removed jruby 9.3.6 from PATH and re-executed glimmer package

Did notice this warning

2022-08-06T18:48:46.385-06:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.
      org.yaml:snakeyaml:1.28:compile

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 7, 2022

That’s normal (just a warning). It has an open issue (non-serious ) under jruby or one of its subprojects.

@jayczech23
Copy link
Contributor Author

Sounds good, still seems to be hanging at JAR generation step with warbler

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 7, 2022

Ok, I think I know why.

Your earlier output contained this:

jruby --version
jruby 9.3.4.0 (2.6.8) 2022-03-23 eff48c1ebf Java HotSpot(TM) 64-Bit Server VM 18.0.2+9-61 on 18.0.2+9-61 +jit [x86_64-mswin32]

Your jruby is not installed correctly against JDK 16. It picked up JDK 18 (must be because you forgot to set JAVA_HOME env var to JDK16), thus is exhibiting the warbler freezing problem.

My recommendation is to uninstall all JDKs and JRubys and start over with JDK 16 and jruby 9.3.4.0 again.

Also, please install git using the windows installer recommended in the glimmer dsl for SWT project: https://git-scm.com/download/win

It is obvious that juwelier had a problem detecting git from power shell and failed to create the local git repo via “git init” automatically.

I think a clean redo (including rescaffolding another project just in case) might resolve all your issues.

@jayczech23
Copy link
Contributor Author

Thanks I will uninstall and try again with a fresh install.

will keep you posted on status.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Aug 8, 2022

@jayczech23 I got good news!

I fixed the issue in the most recent release of Glimmer DSL for SWT: version 4.24.1.3

It now works with JRuby 9.3.6.0 and JDK 18 on Windows 10.

Apparently, the cause of the Warbler freezing problem is the bundler gem that is included in JRuby because it does not include its own gemspec as as the case normally when installed manually (I must have not detected the issue in the past because I probably unconsciously installed a newer version of bundler). If I install the latest bundler (or even reinstall the same bundler version included in JRuby), the problem goes away because bundler ends up having a gemspec, so I updated Glimmer DSL for SWT to do that automatically before scaffolding a project on Windows.

I found a report of the issue at the Warbler project, and I commented on it further to hopefully have the next version of JRuby fix the issue in the included bundler: jruby/warbler#517

So, in your setup, if you haven't deleted it, if you install the latest bundler gem install bundler, the warbler freezing issue should go away. If you blew your setup away and are starting over, then if you install glimmer-dsl-swt v4.24.1.3, it will do that for you automatically, so you can use it with JRuby 9.3.6.0 and JDK 18 (sorry about the back-and-forth.. thanks for your patience).

I am closing this issue for now, but if there are still any unaddressed issues you are concerned about, we can reopen the issue or create a new one if it's a different matter.

Cheers!

@jayczech23
Copy link
Contributor Author

After uninstalling and reinstalling every dependency mentioned above, tried to package an msi from a fresh scaffold. I was able to run glimmer package[msi] successfully, but the only artifact that was generated in the dist folder was a .jar

@jayczech23
Copy link
Contributor Author

Ah I found it under a different folder, please disregard :D

@AndyObtiva
Copy link
Owner

Yes, dist contains the generated jar and packages/bundles contains the generated native package for the app.

@jayczech23
Copy link
Contributor Author

Working beautifully now thanks a lot @AndyObtiva !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants