-
Notifications
You must be signed in to change notification settings - Fork 19
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
Cannot load ZIP gem under certain conditions #449
Comments
Confirmed bug for Windows and 3.3.8. For the |
rubyzip appears to be more current than the zip gem. There us also a good chance that these gems can conflict with the built-in Ruby Zlib. Depending on what your doing with a zip using the builtin is going to be more stable. |
We have a workaround! The problem is 3.3.8 on windows is it's installing gems differently depending on Cobbler vs command line. Either one fails BUT - using both works. Now try your code with a |
Oah.. I did not know that Shoes have its own archive handler. |
It is all nice but zlib cannot handle .zip archive I do tried with your approach to install rubyzip but I get this when trying to open archive : Error in <unknown> line 0 | 2019-08-25 20:26:28 +0300
Zip end of central directory signature not found
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/central_directory.rb:143:in `get_e_o_c_d'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/central_directory.rb:103:in `read_e_o_c_d'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/central_directory.rb:136:in `read_from_stream'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/file.rb:76:in `block in initialize'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/file.rb:75:in `open'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/file.rb:75:in `initialize'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/file.rb:97:in `new'
C:/Program Files (x86)/Shoes/lib/ruby/gems/2.5.0/gems/rubyzip-1.2.3/lib/zip/file.rb:97:in `open'
main.rb:43:in `block in <main>'
eval:1:in `instance_eval'
eval:1:in `block in <main>' |
The good news is Shoes has done it's task - load the gem. What the gem does after that ? Not a Shoes problem ;-) Given it's all Ruby in the gem and you have a traceback and an error message from the gem, you could debug the gem. My guess is the file is not a zip format that the gem can read. There are a lot of zip formats. When I skimmed through the gem, I saw it tries to handle some really old format. That coupled with it's age (works in Ruby 1.9.2!) suggests no one is maintaining it. My guess is the zip file doesn't have a good directory signature (if at all) and you need to set some flags or options before trying to open it. |
Thanks for the help. It was my bad. Final line:
Now all is working well. Technically both libraries -rubyzip and zip 2.0.2 have the same issue through the cobler. This makes me assume that there may be many such issues with other gems. What is the difference between cshoes gem installation and Cobler gem installation? |
That is the path to a solution. Obviously, they are different and shouldn't be. In times past they were not different. It has to do with keeping user loaded gems in HOME\APPDATA\LOCAL instead of |
I see. Should I assume that the design is to move gems to HOME\APPDATA\LOCAL but it was not fully complete on all levels thus issue happens? Is there anything I can help with or it is too much work in things I dont understand (probably)? |
It used to work properly. It's a regression. I have done work in that area for Shoes 3.3.8. It's a regression error. Probably a simple oversight whan I fixed something else. |
Thanks! Closing this one. Cant wait for the new version :) |
…ations like not have rvm or rbenv or ruby on linux, osx)
I believe I have it working properly (again). New Windows beta here. The error actually goes back to fixing gem things for OSX and 'cleanings up while I'm there', Thanks for reporting the bug. |
Yay :) Just tested it. Some feedback |
A 40% jump occasionally sounds like garbage collection but you have to be looking at memory stats to see it (and it shouldn't take a multiple seconds, IMO). It is possible that Ruby 2.5 has changed threading behavior vs the Ruby 2.3 in Shoes 3..3.7. You could play with settings.wintmo values (see the manual). It could be that a low tmo value like 10 isn't giving the script enough time to run before pausing it to check for gui events. Which makes it look slow to respond. Maybe set a value of 50 or 80 to see if that helps. It would hurt download performance. There is a ruby 2.5.5 threading problem with download method that I know about. There could be others. |
@ccoupe it is not threading (unless Shoes do some threading), the code the hangs is sequential, it is just the more the code and things it do on the canvas, the longer the slug. I will test what you say tomorrow and let you know. |
Gtk has a thread and ruby has it's threads and sometimes Shoes has a new thread. It's a weakness in how Shoes 3.2+ is done on Windows. For your testing pleasure and my curiosity I just put up a 32 bit beta. I see a slight difference in loading speed. It also uses ruby 2.4.5 instead of 2.5.5 in the 64bit beta. |
Sadly not much of an improvement on my side :(. I do played with the value but it kind of does not make any difference whatever it is (1-100 range). Isnt that weird? |
That says the problem is not Shoes/Gtk threading or 32 vs 64. Two candidates down - it's progress, I did read about a MSFT 1903 bug that some people have but would likely affect Shoes 3.3.7 as well as .8, Probably not your problem. The changes to shoes 3.3.8 are mostly the newer Rubies. Some restructured C code but those are more cosmetic than functional changes. If you are using menus that could be different. Or possibly the touch screen changes -- do you have a touch pad/screen ? |
Btw the exe i got from the link was 32. I have not done any 64 bit installations so far. |
Huh? Most of the 3.3.8 beta's are 64 bit. |
@ccoupe regarding the 3.3.8 slug, I did some research. Unfortunately it is GTK3 issue. Check this thread here as well. May be this can shed further light. Let me know if there is anything else I can test or I will have to leave 3.3.8 :(. |
The changes to shoes 3.3.8 are almost entirely for Ruby 2.4+. That's not to say the gtk3 and Windows is good - it's not. But Gtk3 is not as bad as some 'internet' people claim. We went through the gtk3 transition back in Shoes 3.3.0 and since. The suggestion to run a Windows profiler is good but probably a lot of work - I for one don't know that level of windows tooling. Shoes used to have a way to run 'gprof' so I can look into that but it's misleading since everything slows down under profiling so you need good test cases and I may not be able to rebuild 3.3.7 with gprof on so the base case would be missing. I can also try to build Shoes 3.3.8 with Ruby 2.3. |
I have two tests you can try. At the beta site are two shoes exe. One is 3.3.7 an one is 3.3.8, both are built with Ruby 2.3, 32bit,debug symbols included - 'Rb23-shoes-3.3.7-gtk3-32.exe' and 'Rb23-shoes-3.3.8-gtk3-32.exe' Both install as Shoes by default so be careful. It's not quite the 3.3.7 you have but it should be very close. 3.3.8 also has a different cobbler menu scheme, just so you know. We need to follow a protocol to narrow this down.
|
Thank you. Will update you as soon as I collect all the data :)! |
Just to hammer a point about reproducibility, I made a mistake generating Rb23-shoes-3.3.8. Sigh. That has been corrected. I also provided a 'Rb24-shoes-3.3.8-gtk3-32.exe' and ' Rb25-shoes-3.3.8-gtk3-64.exe' which use different Ruby versions and the Rb25 is 64 bit. Again, only proceed from one version to the next if everything i(performance wise) is OK. Garbage collection has always been a focus for versions of Ruby so I would be no great surprise for something to change although yours is extreme. I know you use lots of Images which will cause GC to occur sooner and depending on how they are used may not be eligible for GC which could cause a long delay when ruby goes looking for memory and it can't find enough, Other things to consider or note:
|
No worries I have not tested it yet. I did the 3.3.8 tests on 2 separate laptops with windows 10. They have respectively 12 and 16 GB or memory. |
Windows 10 tests: Rb23-shoes-3.3.7 - Has mouse offset. |
Now we are getting somewhere! It appears the the switch from Ruby 2.3 to 2.4 is causing the problem. This may be challenging because I or you are using a ruby method or API that changed behavior for the worse in 2.4 (and 2.5). A scan of the 2.4 release notes is needed by both of us and the more detailed Changelog. |
Or fixes like https://bugs.ruby-lang.org/issues/12690 |
@ccoupe FYI I managed to do a clean release with the 3.3.7. If you want to use it for tests, just download it and run the main.rb under shoes. It should be working. |
@dredknight, Linux has a case sensitive file system - I had to rename code/readskills.rb to code/ReadSkills.rb to match the On linux(Mint), it seems to work for me - but I was just clicking around (using shoes 3.3.8) - Is there a sequence of things to do to get the slowdown? I'm having trouble getting the zip gem to load on my raspberry pi and MacOS -- although different errors -- Odd but very on topic. I also get warnings about class vars used at Toplevel. These could be a problem. I'll poke around with my clone of the code. |
Thank you, I will update the github filenames accordingly. Feel free to do as you wish :). The most cumbersome part (as a Windows user) is when you change heroes with the left/right button at the "Hero pane" (the one with the skill circle). |
Ahh, the gem to install is |
@ccoupe this is the one that I do tested with the slowness? Btw I just now recalled that @backorder pinned each x.x.9 release to be for performance fixes. Let see if he summons around ;). I will make a short video to show the slowness and post it. |
@dredknight , Don't believe future anything about 3.3.9. I'm not sure there will be one. |
Sure I understand the state of the project, decided to see if I can recall @backorder :). |
Is there a chance that during the slow down that the sqlite3 db is being accessed? I ask because I don't see any index'es in the schema. The pics are 14MB on disk so probably double or for main memory. The image cache.probably has all 14MB and untold number of Shoes image objects to be collected plus the Gtk3 image (may be an internal copy there too?) This needs profiling but I'm not familiar with the windows tools. |
@ccoupe, indeed it is accessed during that phase! What the code do is while scrolling between heroes, based on the hero index it gets a table with all his skills and perks, one by one, then based on skill/perk name it draws the image and prepares the hover pop up. |
Creating an index for the table(s) and columns involved may speed up many things and is something you can do w/o touching Shoes or Ruby. Just make a backup first. syntax: I did notice that moving the cursor over icons (to get tooltips) took 25% of a fast processor which I though was odd. Lack of indices could explain it. |
Thank you for the idea! |
Here's an example of a script I used to create a DB, some tables, and index's. The app analyzes downloads on my shoes download logs. |
There is a feedback to return here - indexes help to speed the wheel! Also closing this issue as you did add fixes to the core. |
Hi Cecil,
I found some peculiar issue with the Shoes 3.3.8
Here is the setup.
From CLI or main.rb file I cannot do Require 'zip'
If I go to the cobler -> Manage gems and select "Load test", gem is loaded succesfully.
Why is this happening and how can I troubleshoot it in Shoes?
The text was updated successfully, but these errors were encountered: