Forum: wxRuby Segmentation Fault : [i386-mswin32] in wxruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
90eafd2bc7788572e3db3dd0acb989c0?d=identicon&s=25 Lc Yeap (lcyeap)
on 2009-01-13 08:39
Greetings,

I have created a GUI to generate a output text file using wxruby. my
program codes are about ~1400 lines.
ruby : 1.8.6
wxruby : 1.9.7
rails : 2.1.0

FYI, I am using the TextCtrl & combobox in the main GUI to get the
output file name and main settings. after clicking the button, it will
pop up another frame which let user to select and modified settings with
TextCtrl & combobox. By clicking the button on the new GUI, an output
file will be generated.

But problem occurred if i want to generate multiple files. When i enter
the new name in the TextCtrl for creating new file, the GUI will close
immediately with this error pop up -- > "Bug:Segmentation Fault"

May i know is there any reference for me or suggestion to fix this
problem?

Your help will be highly appreciated. =)
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2009-01-13 08:56
(Received via mailing list)
Well, there's two things here.

First, your using 1.9.7 of Ruby, please upgrade to 1.9.9, and test
again,
before moving on to this second part, there have been many bug fixes
between
1.9.7 and 1.9.9.

Second, and do this only after you tried the first part, if the problem
still occurs, please send us a Minimal example, that can reproduce the
problem that your having, so that we can test it, and see what exactly
is
going on.

hth,
Mario
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2009-01-13 09:23
(Received via mailing list)
By 1.9.7 of Ruby, I mean 1.9.7 of wxRuby, not Ruby itself.
90eafd2bc7788572e3db3dd0acb989c0?d=identicon&s=25 Lc Yeap (lcyeap)
on 2009-01-13 09:28
Mario Steele wrote:
> Well, there's two things here.
>
> First, your using 1.9.7 of Ruby, please upgrade to 1.9.9, and test
> again,
> before moving on to this second part, there have been many bug fixes
> between
> 1.9.7 and 1.9.9.
>
> Second, and do this only after you tried the first part, if the problem
> still occurs, please send us a Minimal example, that can reproduce the
> problem that your having, so that we can test it, and see what exactly
> is
> going on.
>
> hth,
> Mario


Hi Mario,

thanks for the prompt response.
I downloaded the "wxruby-1.9.9-x86-mswin32-60.gem" from RubyForge.
by typing command 'gem install wxruby', system reported that it has
successfully installed wxruby with version 1.9.9.
However, when I run my program again, the same error occurred. -->
"config_vector_v6.rb:1418: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-mswin32]"

so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the
bin folder and reinstalled it again, but still the same error being
reported.
I tried with command "gem update wxruby" but I get this-->"ERROR:  While
executing gem ... (Gem::RemoteFetcher::FetchError)
    No connection could be made because the target machine actively
refused it.
- connect(2)(Errno::ECONNREFUSED)"

Is that I am not using the correct version of wxruby? can you point me
how to upgrade my wxruby? If this still fail again after using wxruby
1.9.9, I will attach a sample code of my program.

Thanks again. =)
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-01-13 10:15
(Received via mailing list)
Lc Yeap wrote:
> However, when I run my program again, the same error occurred. -->
> "config_vector_v6.rb:1418: [BUG] Segmentation fault
> ruby 1.8.6 (2007-09-24) [i386-mswin32]"
>

You can check what version of wxRuby is being used by your program by
looking at the value of Wx::WXRUBY_VERSION. It's printed out in the
"About" box of the minimal sample.
> so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the
> bin folder and reinstalled it again, but still the same error being
> reported.
>

Use gem uninstall, don't delete directly.


> I tried with command "gem update wxruby" but I get this-->"ERROR:  While
> executing gem ... (Gem::RemoteFetcher::FetchError)
>     No connection could be made because the target machine actively
> refused it.
> - connect(2)(Errno::ECONNREFUSED)"
>

Make sure that you have the latest versions of rubygems installed then
try installing wxruby-1.9.9 again.

gem --update system


> Is that I am not using the correct version of wxruby? can you point me
> how to upgrade my wxruby? If this still fail again after using wxruby
> 1.9.9, I will attach a sample code of my program.

OK. It might be worth posting a runnable sample of your code anyway.
There may be something in there obvious that's not quite right -
although wxRuby tries to raise an exception on incorrect use of the API,
this isn't always possible. Or if there is a bug, it may still exist in
the latest development version, in which case sample code will help us
find it quicker.

a
90eafd2bc7788572e3db3dd0acb989c0?d=identicon&s=25 Lc Yeap (lcyeap)
on 2009-01-13 12:09
Attachment: lcyeap_example.rb (9 KB)
Alex Fenton wrote:
> Lc Yeap wrote:
>> However, when I run my program again, the same error occurred. -->
>> "config_vector_v6.rb:1418: [BUG] Segmentation fault
>> ruby 1.8.6 (2007-09-24) [i386-mswin32]"
>>
>
> You can check what version of wxRuby is being used by your program by
> looking at the value of Wx::WXRUBY_VERSION. It's printed out in the
> "About" box of the minimal sample.
>> so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the
>> bin folder and reinstalled it again, but still the same error being
>> reported.
>>
>
> Use gem uninstall, don't delete directly.
>
>
>> I tried with command "gem update wxruby" but I get this-->"ERROR:  While
>> executing gem ... (Gem::RemoteFetcher::FetchError)
>>     No connection could be made because the target machine actively
>> refused it.
>> - connect(2)(Errno::ECONNREFUSED)"
>>
>
> Make sure that you have the latest versions of rubygems installed then
> try installing wxruby-1.9.9 again.
>
> gem --update system
>
>
>> Is that I am not using the correct version of wxruby? can you point me
>> how to upgrade my wxruby? If this still fail again after using wxruby
>> 1.9.9, I will attach a sample code of my program.
>
> OK. It might be worth posting a runnable sample of your code anyway.
> There may be something in there obvious that's not quite right -
> although wxRuby tries to raise an exception on incorrect use of the API,
> this isn't always possible. Or if there is a bug, it may still exist in
> the latest development version, in which case sample code will help us
> find it quicker.
>
> a

Hi Alex,

thanks for your reply. after follow your instructions, I have been
confirmed the version of wxruby that i used is correct, which is 1.9.9.
But, still the same error observed.

Attached is my sample code. The error pop up when i try to generate the
2nd file.

Hope will find out the cause of the error soon as i need this
application to be up.

Thanks a lot. =)
A0a96c3a727abd14e56245ec3f08e6b0?d=identicon&s=25 Kirill Likhodedov (Guest)
on 2009-01-13 12:32
(Received via mailing list)
Lc, you definitely need to simplify your example. Try to make it as
small as
possible. You need the MINIMUM example which reproduces the error. Sad
to
say that, but nobody will look through that amount of code you've given.

2009/1/13 Lc Yeap <lists@ruby-forum.com>
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-01-13 13:00
(Received via mailing list)
Lc Yeap wrote
> thanks for your reply. after follow your instructions, I have been
> confirmed the version of wxruby that i used is correct, which is 1.9.9.
> But, still the same error observed.
>
> Attached is my sample code. The error pop up when i try to generate the
> 2nd file.

I can reproduce the error with mswin32 1.9.9, but not with MingW on
Windows (either 1.9.9 or the latest development version). If someone has
a build of SVN HEAD build of mswin32 handy, perhaps they could give it a
go to see if it's resolved.

As Kiril's said, it'd be easier and quicker to help further if you could
simplify this down a lot, to narrow down the source of the error. For
example, I started by removing the text writing routine, then the
confirmation dialog. Next step might be to remove all the controls
except the 'generate' button.

I don't have time to keep tweaking and running and clicking through your
whole app right now, but if you provide a stripped-down sample
demonstrating the issue, I'm happy to work with that.

alex
90eafd2bc7788572e3db3dd0acb989c0?d=identicon&s=25 Lc Yeap (lcyeap)
on 2009-01-14 01:44
Alex Fenton wrote:
> Lc Yeap wrote
>> thanks for your reply. after follow your instructions, I have been
>> confirmed the version of wxruby that i used is correct, which is 1.9.9.
>> But, still the same error observed.
>>
>> Attached is my sample code. The error pop up when i try to generate the
>> 2nd file.
>
> I can reproduce the error with mswin32 1.9.9, but not with MingW on
> Windows (either 1.9.9 or the latest development version). If someone has
> a build of SVN HEAD build of mswin32 handy, perhaps they could give it a
> go to see if it's resolved.
>
> As Kiril's said, it'd be easier and quicker to help further if you could
> simplify this down a lot, to narrow down the source of the error. For
> example, I started by removing the text writing routine, then the
> confirmation dialog. Next step might be to remove all the controls
> except the 'generate' button.
>
> I don't have time to keep tweaking and running and clicking through your
> whole app right now, but if you provide a stripped-down sample
> demonstrating the issue, I'm happy to work with that.
>
> alex


Hi Kiril & Alex,

Thanks for the advice and helps.
I will try to simplified my code following the guidelines provided.
sorry for not being clear at the beginning. Meanwhile, i will continue
with my debugging works. Will keep on update if I have any finding.

Thanks again. =)
760e5c90000057a6860986b69b77c400?d=identicon&s=25 John Griffiths (indiehead)
on 2009-01-15 14:44
had this problem on some database calls with Windows XP today too...

Ruby 1.8.6
WxRuby 1.9.9
Windows Service Pack 2

What I had to do was fire the Garbage Collector before my mySQL calls

  GC.start
  res.each do |row|
    ...
  end

And then call the rows specifically by number => row[1].to_s

I was using row["name"] with res.each changed to res.each_hash, but it
just kept flipping out with Segmentation Faults so i switched to the
more simpler method above.

After which it remained stable.

Also got problems with NET::SFTP returning Segmentation Faults for
Upload() calls, Ok with Connect() or Dir.foreach calls, but swapped that
out with Putty's SCP for quickness.
This topic is locked and can not be replied to.