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

Fixes for Go 1.4 #79

Closed
wants to merge 3 commits into from
Closed

Fixes for Go 1.4 #79

wants to merge 3 commits into from

Conversation

grahamking
Copy link

Two separate fixes for Go 1.4. It isn't safe to pass a pointer into a function's stack since 1.3, but this seems to blow up much more often in 1.4, maybe because the stack is smaller, so is more likely to be moved.

The xpath commit fixes a test failure in TestEvalVariableExpr. The serialize commit has it's own test.

Details of the general problem here: golang/go#8310

Replaces #78

kisielk and others added 3 commits February 6, 2015 11:17
Previously SetResolver was taking a pointer to an argument, which is
stack allocated.
`serialize` was giving a pointer into it's stack to
`xmlNodeWriteCallback`. If the runtime moves our stack, that pointer
will be invalid. Instead we use the pointer as an integer to index a
map, as recommended here golang/go#8310
Previous commit forgot the lock. Maps are not safe for concurrent access.
@grahamking grahamking mentioned this pull request Feb 18, 2015
@grahamking
Copy link
Author

To anyone considering gokogiri with Go 1.4+, you really need this fix. Things will probably work fine at low traffic, then break up when that increases. Please use this version with the fixes: https://github.com/ThomsonReutersEikon/gokogiri

@jbowtie
Copy link
Contributor

jbowtie commented May 6, 2015

I have to agree with @grahamking -- just yesterday I updated ratago to use their fork until this PR is merged.

@twojtasz
Copy link

First, thanks for the PR Graham. We have considered a slightly different approach for one of the problems you have addressed. Instead of having a callback into go and managing the lock, we instead accumulated the data in C and only perform the callback once. I hope to get this resolved with the rest of your PR and get this merged in in the next two weeks.

@pebbe
Copy link

pebbe commented Mar 2, 2016

I tried github.com/moovweb/gokogiri and github.com/ThomsonReutersEikon/gokogiri with Go 1.6.
Both panic with cgo argument has Go pointer to Go pointer. Is there a fix for this?

@grahamking
Copy link
Author

I'm afraid I don't know of one. The Thomson Reuters project that was using gokogiri switched to etree a while back, all their XML parsing is pure Go now.

The Go<->C rules are finally explicit in Go 1.6, so I'm not surprised there is work needed.

@jbowtie
Copy link
Contributor

jbowtie commented Mar 3, 2016

@pebbe I'll have a look this weekend as I need to update ratago for 1.6 and will submit a PR to both forks.

@voxxit voxxit closed this Jul 13, 2018
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.

6 participants