Segmentation Fault : [i386-mswin32] in wxruby


#1

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. =)


#2

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


#3

By 1.9.7 of Ruby, I mean 1.9.7 of wxRuby, not Ruby itself.


#4

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


#5

Mario S. 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. =)


#6

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 removed_email_address@domain.invalid


#7

Alex F. 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. =)


#8

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


#9

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.


#10

Alex F. 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. =)