Project

General

Profile

Bug #11946

Assertion failed: (!STR_EMBED_P(shared)), function str_new_frozen, file string.c, line 1075.

Added by felixmohnert (Felix Mohnert) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:72701]

Description

Starting the Rails server or running specs for one of our applications results in:

Assertion failed: (!STR_EMBED_P(shared)), function str_new_frozen, file string.c, line 1075.
Abort trap: 6

Previous Ruby versions didn't cause a problem. I wasn't able to to find out what exactly causes it, if you know how to produce a better log here, I'm glad to provide it.

bug11946.rb (294 Bytes) bug11946.rb bjmllr (Ben Miller), 02/02/2016 11:15 PM

Associated revisions

Revision 53724
Added by naruse (Yui NARUSE) over 1 year ago

  • string.c (str_new_frozen): if the given string is embeddedable but not embedded, embed a new copied string. [Bug #11946]

Revision 53724
Added by naruse (Yui NARUSE) over 1 year ago

  • string.c (str_new_frozen): if the given string is embeddedable but not embedded, embed a new copied string. [Bug #11946]

Revision 54416
Added by naruse (Yui NARUSE) over 1 year ago

merge revision(s) 53724: [Backport #11946]

* string.c (str_new_frozen): if the given string is embeddedable
  but not embedded, embed a new copied string. [Bug #11946]

History

#1 [ruby-core:72703] Updated by nobu (Nobuyoshi Nakada) over 1 year ago

Do you have short code to reproduce it, and what platform?
Or if it is reproducible, then run that application from debugger.
.gdbinit for gdb is bundled with the source, break at the line and try rp macro to see the content of orig and shared.

#2 [ruby-core:72707] Updated by atstockland (Adam Stockland) over 1 year ago

I have the exact same problem and message. Wish I had more to add, but I don't. I came on to add an issue and saw Felix beat me to it. I'll follow this issue and participate as I can.

Rails 4.2.5
Ruby 2.3
OS X 10.11.2
Minitest 5.1

Felix Mohnert wrote:

Starting the Rails server or running specs for one of our applications results in:

Assertion failed: (!STR_EMBED_P(shared)), function str_new_frozen, file string.c, line 1075.
Abort trap: 6

Previous Ruby versions didn't cause a problem. I wasn't able to to find out what exactly causes it, if you know how to produce a better log here, I'm glad to provide it.

#3 [ruby-core:72715] Updated by felixmohnert (Felix Mohnert) over 1 year ago

Nobuyoshi Nakada wrote:

Do you have short code to reproduce it, and what platform?

I do not have code to reproduce it but I'm trying to provide you with a snippet today.

The only thing I found out so far:
It happens in

.gem/ruby/2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb

in line 80 which is

server.start

OS X 10.11.2
Ruby 2.3
Rails 4.2.0

#4 [ruby-core:72925] Updated by fredngo (Fred Ngo) over 1 year ago

Ruby 2.3.0
Rails 4.2.5

Confirming for me also. I have traced the problem to this line:

https://github.com/rails/rails/blob/v4.2.5/actionpack/lib/action_dispatch/routing/route_set.rb#L546

in the call to name.to_s.match(/[_a-z]\w*$/i). Specifically, when match() is called.

The strange thing is that when I freeze the string by substituting name.to_s.freeze.match(/[_a-z]\w*$/i) then it passes without the core dump failure.

I know there were some Frozen string changes in 2.3.0 so it might be related to that...

The other thing is that this line doesn't always fail, it only fails on some routes. I have no idea why, because the name is always a string class, and a valid string.

I should add also that I am using ActiveAdmin, which auto-generates some routes for its admin pages. It is failing on one of the auto generated :index routes, but not all of them... Very strange.

As Felix says, this is not a problem with Ruby 2.2.4.

Felix, would you mind checking if you are having the same problem, by linking to a local copy of Rails 4.2.0 and inserting 'puts "**** name=#{name}"' at the beginning of the def add_route method? Then when you start the server, you should see a bunch of routes go by until the problematic route appears.

#5 [ruby-core:73659] Updated by bjmllr (Ben Miller) over 1 year ago

I was able to reduce to a script that doesn't need any gems. I'm using Arch Linux.

#6 [ruby-core:73661] Updated by naruse (Yui NARUSE) over 1 year ago

  • Status changed from Open to Assigned
  • Assignee changed from nobu (Nobuyoshi Nakada) to naruse (Yui NARUSE)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED

Ben Miller wrote:

I was able to reduce to a script that doesn't need any gems. I'm using Arch Linux.

This is so helpful!
I identify the issue!

#7 Updated by naruse (Yui NARUSE) over 1 year ago

  • Status changed from Assigned to Closed

Applied in changeset r53724.


  • string.c (str_new_frozen): if the given string is embeddedable but not embedded, embed a new copied string. [Bug #11946]

#8 [ruby-core:73669] Updated by felixmohnert (Felix Mohnert) over 1 year ago

Thank you Ben Miller for providing the script and thanks to you Yui NARUSE for creating the fix!

#9 [ruby-core:73767] Updated by fredngo (Fred Ngo) over 1 year ago

Will this be released in a patch level release? Or do we have to wait till 2.3.1?

#10 [ruby-core:73768] Updated by nobu (Nobuyoshi Nakada) over 1 year ago

2.3.1 is the next patch level release.

#11 [ruby-core:74594] Updated by joemsak (Joe Sak) over 1 year ago

I have the same setup, Rails 4.2, Ruby 2.3, Active Admin, and I got this bug as soon as I installed the country_select gem https://github.com/stefanpenner/country_select

#12 [ruby-core:74711] Updated by naruse (Yui NARUSE) over 1 year ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE

ruby_2_3 r54416 merged revision(s) 53724.

Also available in: Atom PDF