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

Weird crash with Faker 1.8.3 #982

Closed
viamin opened this issue Jul 13, 2017 · 11 comments
Closed

Weird crash with Faker 1.8.3 #982

viamin opened this issue Jul 13, 2017 · 11 comments

Comments

@viamin
Copy link

@viamin viamin commented Jul 13, 2017

On OS X 10.12.5 with ruby 2.4.1 I'm seeing this crash when rendering a rails email preview:

19:51:13 web.1          | /Users/bart/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/faker-1.8.3/lib/faker.rb:200: [BUG] Segmentation fault at 0x00000000000000
19:51:13 web.1          | ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
19:51:13 web.1          | 
19:51:13 web.1          | -- Crash Report log information --------------------------------------------
19:51:13 web.1          |    See Crash Report log file under the one of following:
19:51:13 web.1          |      * ~/Library/Logs/DiagnosticReports
19:51:13 web.1          |      * /Library/Logs/DiagnosticReports
19:51:13 web.1          |    for more details.
19:51:13 web.1          | Don't forget to include the above Crash Report log file in bug reports.
19:51:13 web.1          | 
19:51:13 web.1          | -- Control frame information -----------------------------------------------
19:51:13 web.1          | c:0091 p:---- s:0642 e:000641 CFUNC  :sample
19:51:13 web.1          | c:0090 p:0030 s:0637 e:000636 METHOD /Users/bart/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/faker-1.8.3/lib/faker.rb:200
19:51:13 web.1          | c:0089 p:0019 s:0632 e:000631 METHOD /Users/bart/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/faker-1.8.3/lib/faker.rb:98
19:51:13 web.1          | c:0088 p:0010 s:0626 e:000625 METHOD /Users/bart/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/faker-1.8.3/lib/faker.rb:122
19:51:13 web.1          | c:0087 p:0010 s:0619 e:000618 METHOD /Users/bart/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/faker-1.8.3/lib/faker/name.rb:8

It's called in my code like this: FactoryGirl.attributes_for(:incoming, from: "#{Faker::Name.name} <#{Faker::Internet.email}>")
But calling Faker::Name.name in the rails console does not reproduce this.

Rolling back to faker 1.7.3 clears up the crash.

@viamin
Copy link
Author

@viamin viamin commented Jul 13, 2017

@ghost
Copy link

@ghost ghost commented Jul 17, 2017

EDIT: macOs v10.12.5 and ruby 2.3.3. And reverting to 1.7.3 didn't fix it for me.
EDIT EDIT: Removed stacktrace, I wasn't having the same issue.

@ghost
Copy link

@ghost ghost commented Jul 17, 2017

I dug some more, correct me if this is a separate issue from Viamin's, but this old issue rails/rails#3488 suggests adding psych directly into the Gemfile. I did this and faker works at whatever version again. @viamin does this fix the issue for you or am I experiencing something different?

@viamin
Copy link
Author

@viamin viamin commented Jul 17, 2017

I already had psych in my Gemfile (because of rails/rails#3488) when I hit this issue.

@owst
Copy link

@owst owst commented Jul 24, 2017

@viamin's issue may well be caused by a Ruby bug which shows up as faker > 1.8.0 uses Random::DEFAULT by default: https://github.com/stympy/faker/blob/6148f01b4f2755358e4dd4928a438be9e55fb11b/lib/faker.rb#L37

That Ruby issue is fixed in ruby/ruby@a14cb8a so you could try compiling a Ruby from trunk to see if it solves the issue. I believe the Ruby fix is scheduled to be backported for the next 2.2, 2.3 and 2.4 releases

@stympy
Copy link
Collaborator

@stympy stympy commented Jul 24, 2017

Thanks for the info, @owst!

@staycreativedesign
Copy link

@staycreativedesign staycreativedesign commented Jul 26, 2017

I can confirm this too :)

@rachel-carvalho
Copy link

@rachel-carvalho rachel-carvalho commented Sep 8, 2017

I can also reproduce this issue, but we're using Ruby 2.3.4, RSpec 3.6 and it only happens when we use it with Zeus (any version).

For now, I'm adding this to my spec helper as a workaround while the ruby bug fix is not published:

Faker::Config.random = Random.new
@yld
Copy link

@yld yld commented Sep 19, 2017

This bug should be closed now as 3 new Ruby versions had been released, see https://www.ruby-lang.org/en/news/2017/09/14/ruby-2-4-2-released/.

https://bugs.ruby-lang.org/issues/13753 is closed too

Ruby 2.4.2 and 2.3.5 does'nt segfault any more. I personnaly did'nt try 2.2.8.

@stympy
Copy link
Collaborator

@stympy stympy commented Sep 19, 2017

Thanks, @yld!

@ckritzinger
Copy link

@ckritzinger ckritzinger commented May 11, 2018

FWIW, beware the "innocuous" point update from 2.4.1 to 2.4.2

rubocop/rubocop#4793

There is a breaking change in syntax...

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

Successfully merging a pull request may close this issue.

None yet
7 participants