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

'alert' causes seg fault in Windows #136

Closed
kvberge opened this Issue Jul 13, 2015 · 10 comments

Comments

Projects
None yet
3 participants
@kvberge

kvberge commented Jul 13, 2015

Running this simple test app:


class TestApp < Shoes

  url '/', :index

  def index

    button("Click me") do
      alert "Beef!"
    end
  end
end


Shoes.app(:title => "A simple test app",
          :width => 500,
          :height => 400,
          :resizable => false,
          )

causes a nasty seg fault when the button is clicked. It appears that changing the above to this:


Shoes.app(:title => "A simple test app",
          :width => 500,
          :height => 400,
          :resizable => false,
          ) do

  button("Click me") do
      alert "Beef!"
  end

end

does NOT cause the seg fault. So it appears the subclassing of Shoes is causing some sort of issue.

Here's the seg fault output:

C:\projects\ruby\shoes>cshoes test.rb
test.rb:9: [BUG] Segmentation fault
ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0010 e:000009 CFUNC  :alert
c:0003 p:0009 s:0006 e:000005 BLOCK  test.rb:9 [FINISH]
c:0002 p:---- s:0004 e:000003 CFUNC  :call
c:0001 p:0000 s:0002 E:0007c4 TOP    [FINISH]

-e:0:in `call'
test.rb:9:in `block in index'
test.rb:9:in `alert'

-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(ZwWaitForSingleObject+0x15) [0x77A1F8B1]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x75751194]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x75751148]
C:\Program Files (x86)\Shoes\msvcrt-ruby210.dll(rb_vm_bugreport+0xa7) [0x6D388C07]
C:\Program Files (x86)\Shoes\msvcrt-ruby210.dll(rb_name_err_mesg_new+0x69f) [0x6D24440F]
C:\Program Files (x86)\Shoes\msvcrt-ruby210.dll(rb_bug+0x2e) [0x6D2451BE]
C:\Program Files (x86)\Shoes\msvcrt-ruby210.dll(rb_check_safe_str+0x33b) [0x6D30AFFB]
C:\Program Files (x86)\Shoes\cshoes.exe(WinMain+0x626) [0x00401B86]
C:\Windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x77A774DF]

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:

    0 enumerator.so
    1 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/enc/encdb.so
    2 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/enc/iso_8859_1.so
    3 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/enc/trans/transdb.so
    4 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/rbconfig.rb
    5 thread.rb
    6 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/thread.so
    7 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/compatibility.rb
    8 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb
    9 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/deprecate.rb
   10 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/errors.rb
   11 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/version.rb
   12 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/requirement.rb
   13 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/platform.rb
   14 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb
   15 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb
   16 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/util/stringio.rb
   17 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb
   18 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/exceptions.rb
   19 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/rubygems/defaults/operating_system.rb
   20 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb
   21 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
   22 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/monitor.rb
   23 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb
   24 C:/Program Files (x86)/Shoes/lib/ruby/site_ruby/2.1.0/rubygems.rb
   25 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/etc.so
   26 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/fileutils.rb
   27 C:/Program Files (x86)/Shoes/lib/shoes/download.rb
   28 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/tmpdir.rb
   29 C:/Program Files (x86)/Shoes/lib/shoes/cache.rb
   30 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/common.rb
   31 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/generic.rb
   32 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/ftp.rb
   33 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/http.rb
   34 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/https.rb
   35 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/ldap.rb
   36 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/ldaps.rb
   37 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri/mailto.rb
   38 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/uri.rb
   39 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/stringio.so
   40 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/date_core.so
   41 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/date/format.rb
   42 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/date.rb
   43 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/time.rb
   44 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/open-uri.rb
   45 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/optparse.rb
   46 C:/Program Files (x86)/Shoes/lib/shoes/inspect.rb
   47 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/digest.so
   48 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/digest.rb
   49 C:/Program Files (x86)/Shoes/lib/ruby/2.1.0/i386-mingw32/digest/sha1.so
   50 C:/Program Files (x86)/Shoes/lib/shoes/image.rb
   51 C:/Program Files (x86)/Shoes/lib/shoes.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Here's my version of shoes: Shoes federales 3.2.24 r2053 i386-mingw32 2.1.6

Ruby Version:
C:\projects\ruby\shoes>cshoes --ruby --version ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]

I use this version of shoes to take advantage of the Time.now fix that addressed the incorrect TZ being used.

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 13, 2015

Contributor

idem on linux, ruby 2.1.5, latest git shoes
i have
-- C level backtrace information -------------------------------------------
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(+0x1e29ec) [0x7f40bd2299ec] vm_dump.c:690
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(+0x77533) [0x7f40bd0be533] fputwc.c:44
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(rb_bug+0xb3) [0x7f40bd0bf183] libioP.h:905
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(+0x15a2ef) [0x7f40bd1a12ef] ../sysdeps/x86_64/multiarch/strcpy-ssse3.S:1979
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f40bce39340] ../nptl/sysdeps/pthread/funlockfile.c:29
shoes3/dist/shoes(shoes_dialog_alert+0xce) [0x41e2df] shoes/native/gtk.c:1673
...
gtk.c:1673 : char *apptitle = RSTRING_PTR(app->title); //default is "Shoes"

Contributor

passenger94 commented Jul 13, 2015

idem on linux, ruby 2.1.5, latest git shoes
i have
-- C level backtrace information -------------------------------------------
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(+0x1e29ec) [0x7f40bd2299ec] vm_dump.c:690
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(+0x77533) [0x7f40bd0be533] fputwc.c:44
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(rb_bug+0xb3) [0x7f40bd0bf183] libioP.h:905
.rvm/rubies/ruby-2.1.5/lib/../lib/libruby.so.2.1(+0x15a2ef) [0x7f40bd1a12ef] ../sysdeps/x86_64/multiarch/strcpy-ssse3.S:1979
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f40bce39340] ../nptl/sysdeps/pthread/funlockfile.c:29
shoes3/dist/shoes(shoes_dialog_alert+0xce) [0x41e2df] shoes/native/gtk.c:1673
...
gtk.c:1673 : char *apptitle = RSTRING_PTR(app->title); //default is "Shoes"

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 13, 2015

Contributor

My ytm.shy (http:///walkabout.mvmanila.com/public/share) is another app that uses the url/visit methods and the segfault also happens on confirm() as well as alert(). This may be a very old bug in Shoes since the url/visit method for building Shoes apps is mostly undocumented and quirky.

Contributor

ccoupe commented Jul 13, 2015

My ytm.shy (http:///walkabout.mvmanila.com/public/share) is another app that uses the url/visit methods and the segfault also happens on confirm() as well as alert(). This may be a very old bug in Shoes since the url/visit method for building Shoes apps is mostly undocumented and quirky.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 14, 2015

Contributor

The back trace clearly points to code we added in 3.2 for #59 so that is the more likely source of the problem. the *app struct is indeed setup incorrectly (or incomplete) when Shoes is subclassed.

Contributor

ccoupe commented Jul 14, 2015

The back trace clearly points to code we added in 3.2 for #59 so that is the more likely source of the problem. the *app struct is indeed setup incorrectly (or incomplete) when Shoes is subclassed.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 14, 2015

Contributor

Eventually, both the working example and the failing example end up in shoes_app_run() app.c with the working example having exec->ieval =1 and the non working with exec->ieval =0 and then the link to app->anything gets pretty murky.

Contributor

ccoupe commented Jul 14, 2015

Eventually, both the working example and the failing example end up in shoes_app_run() app.c with the working example having exec->ieval =1 and the non working with exec->ieval =0 and then the link to app->anything gets pretty murky.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 15, 2015

Contributor

I've found the problem. Commit 8c95e3d uses a new macro which doesn't init app properly for the of url/visit method of coding a Shoes app. @passenger94 - do you remember why GLOBAL_APP needed replacing ?

Contributor

ccoupe commented Jul 15, 2015

I've found the problem. Commit 8c95e3d uses a new macro which doesn't init app properly for the of url/visit method of coding a Shoes app. @passenger94 - do you remember why GLOBAL_APP needed replacing ?

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 15, 2015

Contributor

yes, like the title of the commit tells "alert, confirm, ask above window which launched them" :-) with multiple windows, alert and co were allways launched above main (1rst) which is pretty annoying...
So self is not the same when using url/visit, probably self here is the subclass ...? needs investigating, there is always the shoes_world->apps path to fall through

Contributor

passenger94 commented Jul 15, 2015

yes, like the title of the commit tells "alert, confirm, ask above window which launched them" :-) with multiple windows, alert and co were allways launched above main (1rst) which is pretty annoying...
So self is not the same when using url/visit, probably self here is the subclass ...? needs investigating, there is always the shoes_world->apps path to fall through

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 15, 2015

Contributor

Ah yes, #119. For the moment, I've gone back to the older code because annoy is better than segfault breakage. @passenger94 , would you like to assign yourself to the problem or wait for me to get to it?

@kvberge , (or anybody else watch), there is are betas 3.2.24 at http://walkabout.mvmanila.com/public/shoes that fix this problem (but don't fix #119)

Contributor

ccoupe commented Jul 15, 2015

Ah yes, #119. For the moment, I've gone back to the older code because annoy is better than segfault breakage. @passenger94 , would you like to assign yourself to the problem or wait for me to get to it?

@kvberge , (or anybody else watch), there is are betas 3.2.24 at http://walkabout.mvmanila.com/public/shoes that fix this problem (but don't fix #119)

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 15, 2015

Contributor

@ccoupe, ok, i'll get some time by the end of the week/next week
as usual if you need it fastly, please proceed :-)

Contributor

passenger94 commented Jul 15, 2015

@ccoupe, ok, i'll get some time by the end of the week/next week
as usual if you need it fastly, please proceed :-)

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 17, 2015

Contributor

see #119

Contributor

passenger94 commented Jul 17, 2015

see #119

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 18, 2015

Contributor

@kvberge There is a yet another 3.2.24 beta that fixes your problem at http://walkabout.mvmanila.com/public/shoes/shoes-3.2.24-gtk2-32.exe

Thanks for the bug report. We can't fix what we don't see and this one was pretty damn not very obvious. It was also a lurker so I was correct that it goes way back in time.

Contributor

ccoupe commented Jul 18, 2015

@kvberge There is a yet another 3.2.24 beta that fixes your problem at http://walkabout.mvmanila.com/public/shoes/shoes-3.2.24-gtk2-32.exe

Thanks for the bug report. We can't fix what we don't see and this one was pretty damn not very obvious. It was also a lurker so I was correct that it goes way back in time.

@ccoupe ccoupe added this to the 3.2.24 milestone Jul 30, 2015

@ccoupe ccoupe closed this Aug 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment