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

openssl 1.0.2j, freetds 1.00.21, and openssl shared lib generation #322

Merged
merged 1 commit into from
Dec 7, 2016
Merged

openssl 1.0.2j, freetds 1.00.21, and openssl shared lib generation #322

merged 1 commit into from
Dec 7, 2016

Conversation

coderjoe
Copy link
Contributor

So with respect to issue #310 I was running into 3 distinct problems

  1. When running tiny_tds in half of our 64 bit and 32bit windows environments tinytds could not load due to being an invalid win32 executable. (The provided workarounds did not work for us)
  2. After updating to openssl 1.0.2j, on 64 bit windows environments I received an error: 998: invalid memory access in windows
  3. Builds would intermittently fail on appveyor for ruby 2.2x64

All three of these problems seemed to boil down to the dllwrap dll creation in the native build process. In my searches I found numerous references to dllwrap occasionally causing problems when dll relocation occurs.

To test I removed the custom DLL generation, removed the symbol stripping (for debugging purposes) and rebuilt. Upon rebuild all tests pass, and when used on an instance experiencing invalid win32 application it proceeds as normal.

Now I'm not entirely sure why tinytds is building its own openssl shared libraries but letting openssl generated the libraries seems to have solved my problems. Thoughts?

Copy link
Contributor Author

@coderjoe coderjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the bigger changes I made will require review from someone more knowledgeable than myself. They seem to solve my problems but I don't know about wider implications.

file "ports/#{host}/bin/#{dll}" do |t|
sh 'x86_64-w64-mingw32-strip', t.name
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this stuff so I could use the symbols while debugging and it seemed like some symbols which looked useful for relocation may also have been removed... but I couldn't confirm so I left it removed...

@@ -157,7 +157,7 @@ def configure
end
args = [ "CFLAGS=-DDSO_WIN32",
"./Configure",
"no-shared",
"shared",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not sure about the implications of this change. The resulting binaries have different exports, different sizes, and different symbols, and use a different build process than the old dllwrap. Given the comment below I'm not sure how safe this is. Any ideas?

@@ -39,5 +39,8 @@ environment:
secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk=
matrix:
- ruby_version: "23-x64"
- ruby_version: "23"
- ruby_version: "22-x64"
- ruby_version: "22"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these back because for a while I was getting failures in one or two, but not all.

@metaskills
Copy link
Member

metaskills commented Dec 2, 2016

This is amazing work. I honestly need to rely on you to make the calls on these because this area of TinyTDS is most unfamiliar to me.

Is there anything else you want to do before I merge this? Are there any next steps after this? I am hitting Rails v5 in the adapter hard, could you help with moving the adapter to the new miniportile docker work so we can build and push new Windows gems?

@metaskills
Copy link
Member

@coderjoe I added you as a collaborator. Feel free to merge when ready. Super appreciate the help!

@coderjoe
Copy link
Contributor Author

coderjoe commented Dec 2, 2016

Thank you very much for your incredible responsiveness in helping me resolve this issue especially around the holidays. I'm glad it has been helpful.

I've got some changes I want to make before committing, so I'm going to close this PR and continue to work my forked branch so I can make changes without fear of them accidentally being merged. I'll submit a new PR once it's cleaned up, re-tested, and ready to go. :)

I don't have much availability tomorrow to work on opensource stuff, but I hope to be able to put get everything together ASAP probably this weekend at the latest.

@coderjoe coderjoe closed this Dec 2, 2016
@metaskills
Copy link
Member

Either works fine, you could have kept this open and made commits to see the builds run. Leaving it open would also mean others could find it more easily and comment. Don't sweat the churn to this branch either. Once you are ready, we can do a squash merge to keep it clean. Either way, whatever works best for you.

@coderjoe
Copy link
Contributor Author

coderjoe commented Dec 2, 2016

Oh that's a really good point. I'll re-open for visibility's sake. Thanks for the advice. 😄

@coderjoe coderjoe reopened this Dec 2, 2016
@coderjoe
Copy link
Contributor Author

coderjoe commented Dec 5, 2016

@metaskills do you know of any way to convince appveyor to rebuild a commit without re-committing? It failed on my most recent commit but it looks like it might be a network error and nothing more.

@metaskills
Copy link
Member

do you know of any way to convince appveyor to rebuild a commit without re-committing?

Sadly not without logging into Appveyor and clicking re-build. But logging in is limited to the #rails-sqlserver account where I set that up. So no-op commits are best.

The state of this PR looks fine. Can I merge this work in?

- Fix openssl being out of date. (Bumped to 1.0.2j)

- Fix freetds being out of date. (Bumped to 1.00.21)

- Fix the invalid w32 application error which occurs on x64 platforms
  occasionally due to problems with DLLs generated via dllwrap after
  being relocated.

Relates to: #290 and #310
@coderjoe
Copy link
Contributor Author

coderjoe commented Dec 7, 2016

@metaskills presuming this last test run passes and you can't duplicate any failures on Azure (I haven't had time to test it yet myself) then I'm good to merge. :)

@metaskills
Copy link
Member

Hit the button whenever you are ready :) I recommend a squash merge with a wrapped up commit message. I'm starting work in the adapter now. Trying to fix the forgetting assignment bug.

@coderjoe coderjoe merged commit ed691ff into rails-sqlserver:master Dec 7, 2016
@coderjoe coderjoe deleted the openssl-1.0.2j branch December 14, 2016 01:10
aharpervc pushed a commit to aharpervc/tiny_tds that referenced this pull request Apr 9, 2020
- Fix openssl being out of date. (Bumped to 1.0.2j)

- Fix freetds being out of date. (Bumped to 1.00.21)

- Fix the invalid w32 application error which occurs on x64 platforms
  occasionally due to problems with DLLs generated via dllwrap after
  being relocated.

Relates to: rails-sqlserver#290 and rails-sqlserver#310
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants