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

FrozenError: can't modify frozen String: "" #665

Closed
firefart opened this issue Dec 29, 2019 · 8 comments
Closed

FrozenError: can't modify frozen String: "" #665

firefart opened this issue Dec 29, 2019 · 8 comments

Comments

@firefart
Copy link

Since upgrading the apm gem to 3.3.0 the logs are filled with this message. The APM server is a elastic cloud hosted instance

web_1          | E, [2019-12-29T21:32:57.460146 #76] ERROR -- : [ElasticAPM] Couldn't establish connection to APM Server:
web_1          | "#<FrozenError: can't modify frozen String: \"\">"
@firefart firefart changed the title FrozenError: can't modify frozen String: \"\"> FrozenError: can't modify frozen String: "" Dec 29, 2019
@mikker
Copy link
Contributor

mikker commented Jan 2, 2020

Hi @firefart (great name 😂)

Could you try running the agent with log_level: 0 and see if you get more information?

@mikker
Copy link
Contributor

mikker commented Jan 2, 2020

And maybe provide your agent configuration if anything is set to non-default settings. Thanks!

@firefart
Copy link
Author

firefart commented Jan 3, 2020

Adding log_level: 0 does not give any more information it seems.

elastic_apm.yml:

# Set service name - allowed characters: 
# a-z, A-Z, 0-9, -, _ and space
# Defaults to the name of your Rails app
service_name: 'xxxx'

# Use if APM Server requires a token
#
secret_token: <%= ENV['APM_TOKEN'] %>

# Set custom APM Server URL (
# default: http://localhost:8200)
#
server_url: <%= ENV['APM_SERVER_URL'] %>

# alpine does not like the amazon certificate it seems
verify_server_cert: false

log_level: 0

Environment:
Ruby: 2.7.0 (alpine docker image)
elastic-apm 3.3.0

@firefart
Copy link
Author

firefart commented Jan 3, 2020

Maybe it would be a nice addition to add e.backtrace here

"Couldn't establish connection to APM Server:\n%p", e.inspect
if the log level matches?

@firefart
Copy link
Author

firefart commented Jan 5, 2020

Ok the log_level never worked because it was overwritten by rubys loglevel. I now changed the gem a little bit and here is the stacktrace:

E, [2020-01-05T01:35:42.364893 #55] ERROR -- : [ElasticAPM] Couldn't establish connection to APM Server:
#<FrozenError: can't modify frozen String: "">
E, [2020-01-05T01:35:42.365114 #55] ERROR -- : [ElasticAPM] Traceback (most recent call last):
        5: from /usr/local/bundle/ruby/2.7.0/bundler/gems/apm-agent-ruby-997a01f1dc75/lib/elastic_apm/transport/connection/http.rb:92:in `block in open_request_in_thread'
        4: from /usr/local/bundle/ruby/2.7.0/bundler/gems/apm-agent-ruby-997a01f1dc75/lib/elastic_apm/transport/connection/http.rb:32:in `post'
        3: from /usr/local/bundle/ruby/2.7.0/bundler/gems/apm-agent-ruby-997a01f1dc75/lib/elastic_apm/transport/connection/http.rb:46:in `request'
        2: from /usr/local/bundle/ruby/2.7.0/gems/http-4.2.0/lib/http/response.rb:94:in `flush'
        1: from /usr/local/bundle/ruby/2.7.0/gems/http-4.2.0/lib/http/response/body.rb:52:in `to_s'
/usr/local/bundle/ruby/2.7.0/gems/http-4.2.0/lib/http/response/body.rb:52:in `force_encoding': can't modify frozen String: "" (FrozenError)

@firefart
Copy link
Author

firefart commented Jan 5, 2020

Looks like this error is caused by the http gem: httprb/http#582

@mikker
Copy link
Contributor

mikker commented Jan 6, 2020

Thanks for looking into it. We'll have to wait for the Http.rb team to fix it unless you want to run with their master.

@firefart
Copy link
Author

firefart commented Jan 9, 2020

A new version of the http gem (4.3.0) was released to fix this issue.

@firefart firefart closed this as completed Jan 9, 2020
lostie added a commit to lostie/loqate that referenced this issue May 7, 2020
The version currently in use has an incompatibility with Ruby 2.7: httprb/http#582

The earliest version with a fix for this is 4.3.0 (as per noted here:
elastic/apm-agent-ruby#665 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants