Project

General

Profile

Actions

Bug #11946

closed

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

Added by felixmohnert (Felix Mohnert) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
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.


Files

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

Updated by nobu (Nobuyoshi Nakada) almost 9 years 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.

Updated by atstockland (Adam Stockland) almost 9 years 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.

Updated by felixmohnert (Felix Mohnert) almost 9 years 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

Updated by fredngo (Fred Ngo) almost 9 years 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.

Updated by bjmllr (Ben Miller) almost 9 years ago

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

Updated by naruse (Yui NARUSE) almost 9 years 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!

Actions #7

Updated by naruse (Yui NARUSE) almost 9 years 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]

Updated by felixmohnert (Felix Mohnert) almost 9 years ago

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

Updated by fredngo (Fred Ngo) over 8 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

2.3.1 is the next patch level release.

Updated by joemsak (Joe Sak) over 8 years 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

Updated by naruse (Yui NARUSE) over 8 years 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0