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

Bug fix for field index #17

Merged
merged 1 commit into from
Sep 15, 2017
Merged

Bug fix for field index #17

merged 1 commit into from
Sep 15, 2017

Conversation

erikjmiller
Copy link
Contributor

An error was generated when compiling files that "use Thrash.Protocol.Binary". The only thing I can think of is I am using 1.5.1 which could have change how some of the matching occurs.

** (CompileError) test/simple_struct.ex:14: cannot invoke remote function :erlang.+/2 inside match
(elixir) src/elixir_bitstring.erl:65: :elixir_bitstring.expand_expr/4
(elixir) src/elixir_bitstring.erl:19: :elixir_bitstring.expand/6
(elixir) src/elixir_bitstring.erl:9: :elixir_bitstring.expand/4

After some investigation it looks like we should be evaluating ix + 1 prior to performing any matching, so I changed that and all tests passed.

I'm not entirely sure this is an appropriate fix, though I have tested thrift object (de)serialization and everything works including the existing test cases.

An error was generated when compiling files that "use Thrash.Protocol.Binary".  

** (CompileError) test/simple_struct.ex:14: cannot invoke remote function :erlang.+/2 inside match
    (elixir) src/elixir_bitstring.erl:65: :elixir_bitstring.expand_expr/4
    (elixir) src/elixir_bitstring.erl:19: :elixir_bitstring.expand/6
    (elixir) src/elixir_bitstring.erl:9: :elixir_bitstring.expand/4


After some investigation it looks like we should be evaluating ix + 1 prior to performing any matching, so I changed that and all tests passed.
@dantswain
Copy link
Owner

Thanks @erikmiller ! I'm out of town on vacation. I'll take a look at this sometime next week. I recommend also taking a look at Pinterest/Elixir-thrift - the thrift_tng branch (I'd get a better link but I'm on my phone). That branch hasn't been released yet but I've been using it in production for a while now and it's a pretty easy transition from thrash.

@isaacsanders
Copy link

@erikmiller You are a gentleman and a scholar.

@dantswain I would appreciate this, too. I hope you had a good vacation.

@dantswain
Copy link
Owner

@isaacsanders thanks for the bump - this had honestly slipped my mind :(

@erikmiller Does the test suite reproduce your bug in 1.5.1? I would like to update the build matrix and see if I can replicate this in travis (I'll do a separate PR). Then we can verify that this fixes it.

Also, I strongly recommend taking a look at https://github.com/pinterest/elixir-thrift - the thrift_tng branch currently has the new implementation, but we are very close to merging into master. I know it's not always easy to swap out libraries, though, so I will definitely try to get thrash working for you :)

@erikjmiller
Copy link
Contributor Author

@dantswain Yeah the bug still occurs in 1.5.1.

@isaacsanders
Copy link

isaacsanders commented Sep 15, 2017

@dantswain I hope that means it was a good vacation 😁

Having also implemented the change in my local copy of the package in my deps/ for the project that uses it, the project now compiles with the given change. (We are also on 1.5.1)

@dantswain
Copy link
Owner

@isaacsanders It was a fantastic vacation, and also a week at ElixirConf :-D

@isaacsanders and @erikmiller can you check out #18 and see if the versions of OTP and Elixir you use are covered? I'm using the newest patch levels for each minor release of Elixir from 1.1 to 1.5. Matching up versions of Elixir and OTP is a bit tricksy.

@erikjmiller
Copy link
Contributor Author

@dantswain Looks good to me.

@dantswain dantswain merged commit 4bcbada into dantswain:master Sep 15, 2017
@dantswain
Copy link
Owner

OK, merged this and am running my travis branch one more time. Assuming that passes I'll get it merged and release a hotfix this afternoon. Thanks again guys!

@dantswain
Copy link
Owner

Sorry for the delay. 0.3.3 published to hex this morning. Thanks for the report and the fix!!

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

Successfully merging this pull request may close these issues.

3 participants