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

"Cannot unmarshal string into Go struct field StackFrame.line" after truncating big notices #285

Closed
m5rk opened this issue Nov 28, 2017 · 12 comments
Labels

Comments

@m5rk
Copy link

m5rk commented Nov 28, 2017

We're unable to send airbrakes with Rails 5.1 and airbrake 7.1.0, airbrake-ruby 2.6.0. We get this error in our heroku logs:

**Airbrake: json: cannot unmarshal string into Go value of type models.StackFrame 
@kyrylo kyrylo added the Bug label Nov 28, 2017
@m5rk
Copy link
Author

m5rk commented Nov 28, 2017

I posted the notice json, but deleted it because it has some slightly sensitive information in it.

@m5rk
Copy link
Author

m5rk commented Nov 28, 2017

Here's a relevant snippet:

        {
          "file": "[GEM_ROOT]/gems/rack-timeout-0.4.2/lib/rack/timeout/support/timeout.rb",
          "line": "[Circular]",
          "function": "timeout",
          "code": {
            "17": "    thr = Thread.current                                    # reference to current thread to be used in timeout thread",
            "18": "    job = @scheduler.run_in(secs) { @on_timeout.call thr }  # schedule this thread to be timed out; should get cancelled if block completes on time",
            "19": "    return block.call                                       # do what you gotta do",
            "20": "  ensure                                                    #",
            "21": "    job.cancel! if job                                      # cancel the scheduled timeout job; if the block completed on time, this"
          }
        },

@saks
Copy link

saks commented Nov 28, 2017

same problem here, we keep getting errors like:

**Airbrake: json: cannot unmarshal string into Go struct field StackFrame.line of type int

when trying to notify a message using Airbrake.notify or notify_airbrake

@m5rk
Copy link
Author

m5rk commented Nov 29, 2017

The workaround we used:

# TODO: Remove these constraints (and the line for airbrake-ruby) once truncation bug in Airbrake is fixed.
gem 'airbrake-ruby', '2.5.1'
gem 'airbrake', '7.0.3'

@saks
Copy link

saks commented Nov 29, 2017

We do it similar way:

gem 'airbrake-ruby', '2.5.1'
gem 'airbrake'

It looks like the latest version of "airbrake" gem is fine

kyrylo added a commit that referenced this issue Nov 29, 2017
Fixes #285 (Error in stackframe json)
@kyrylo
Copy link
Contributor

kyrylo commented Nov 29, 2017

Hey guys, sorry about this bug.

Can anybody try out this PR? #286
I think it'll fix the issue but prior to merging, I'd like to get a confirmation.

kyrylo added a commit that referenced this issue Nov 29, 2017
Fixes #285 (Error in stackframe json)
@kyrylo kyrylo changed the title Error in stackframe json "Cannot unmarshal string into Go struct field StackFrame.line" while truncating big notices Nov 29, 2017
@kyrylo kyrylo changed the title "Cannot unmarshal string into Go struct field StackFrame.line" while truncating big notices "Cannot unmarshal string into Go struct field StackFrame.line" after truncating big notices Nov 29, 2017
@kyrylo
Copy link
Contributor

kyrylo commented Nov 30, 2017

I'm going to merge it today and release a new version nevertheless because this bug is critical.

kyrylo added a commit that referenced this issue Dec 1, 2017
Fixes #285 (Error in stackframe json)
kyrylo added a commit that referenced this issue Dec 1, 2017
Fixes #285 (Error in stackframe json)
@kyrylo
Copy link
Contributor

kyrylo commented Dec 1, 2017

Released this fix in v2.6.1.

@saks
Copy link

saks commented Dec 1, 2017

I've upgraded to the latest version (sorry had no chance to get to it earlier) and seems still having this problem:
Gemfile.lock:

    airbrake (7.1.0)
      airbrake-ruby (~> 2.5)
    airbrake-ruby (2.6.1)

Log:

E, [2017-12-01T18:26:26.697504 #8] ERROR -- : **Airbrake: json: cannot unmarshal string into Go struct field StackFrame.code of type map[int]string

@kyrylo kyrylo reopened this Dec 1, 2017
kyrylo added a commit that referenced this issue Dec 4, 2017
Additional fix for #285
("Cannot unmarshal string into Go struct field StackFrame.line" after truncating
big notices)

The problem is that `.include?` compares object hashes. For example, if we do

```
h1 = { a: 1 }
h2 = { a: 1 }

a = [h1, h2]
```

...then `h1 == h2`. Thus, if we truncate `a`, the truncator will incorrectly
mark them as circular. However, their object ids are different and they're not
really circular.
kyrylo added a commit that referenced this issue Dec 4, 2017
Additional fix for #285
("Cannot unmarshal string into Go struct field StackFrame.line" after truncating
big notices)

The problem is that `.include?` compares object hashes. For example, if we do

```
h1 = { a: 1 }
h2 = { a: 1 }

a = [h1, h2]
```

...then `h1 == h2`. Thus, if we truncate `a`, the truncator will incorrectly
mark them as circular. However, their object ids are different and they're not
really circular.
kyrylo added a commit that referenced this issue Dec 4, 2017
Additional fix for #285
("Cannot unmarshal string into Go struct field StackFrame.line" after truncating
big notices)

The problem is that `.include?` compares object hashes. For example, if we do

```
h1 = { a: 1 }
h2 = { a: 1 }

a = [h1, h2]
```

...then `h1 == h2`. Thus, if we truncate `a`, the truncator will incorrectly
mark them as circular. However, their object ids are different and they're not
really circular.
@kyrylo kyrylo closed this as completed Dec 4, 2017
@kyrylo
Copy link
Contributor

kyrylo commented Dec 4, 2017

Please upgrade to v2.6.2. I hope this bug is fixed.

@JasonBarnabe
Copy link

This version is seems to be working for me.

@kyrylo
Copy link
Contributor

kyrylo commented Dec 4, 2017

Thanks for testing, that's good news!

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

No branches or pull requests

4 participants