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

Problems in Ubuntu #15

Closed
ivannp opened this issue Dec 2, 2018 · 6 comments
Closed

Problems in Ubuntu #15

ivannp opened this issue Dec 2, 2018 · 6 comments

Comments

@ivannp
Copy link

ivannp commented Dec 2, 2018

Great idea to get away from the tcl deal!!

I was able to install and run it in windows.

In ubuntu 18.04, the run succeeds but there is a segmentation fault at the end:

♠65♡J63♢KT98♣6432 ♠J72♡T75♢AJ2♣AQT9 ♠AKT943♡82♢43♣K85 ♠Q8♡AKQ94♢Q765♣J7

Tries: 10
Segmentation fault (core dumped)

In ubuntu 16.04, it fails without generating any hands:

Memory::GetPtr: 0 vs. 0
Memory::GetPtr: 0 vs. 0

Any idea what's going on? Or how to debug it?

In all cases I am running it from anaconda environment.

@anntzer
Copy link
Owner

anntzer commented Dec 2, 2018

I know about the segfault at exit, but am not sure about how to fix it. Looks like something with threading setup/teardown in dds code.
Can you try applying the following patch

diff --git i/redeal/dds.py w/redeal/dds.py
index 0543db6..e2dfb65 100644
--- i/redeal/dds.py
+++ w/redeal/dds.py
@@ -170,8 +170,7 @@ if dll_name and os.path.exists(dll_path):
         Deal, c_int, c_int, c_int, POINTER(FutureTricks), c_int]
     dll.SolveBoardPBN.argtypes = [
         DealPBN, c_int, c_int, c_int, POINTER(FutureTricks), c_int]
-    if os.name == "posix":
-        dll.SetMaxThreads(0)
+    dll.SetThreading(0)
 else:
     def solve(deal, strain, declarer):
         raise Exception("Unable to load DDS.  `solve` is unavailable.")

or alternatively call dll.SetMaxThreads(1) instead of SetMaxThreads(0)?

Another option would be to remove the args "THREADING=", "CC_BOOST_LINK=" in setup.py (which disable multithreading) in setup.py, although I'd rather avoid that as that would mean requiring additional headers at build time.

Let me know if any of these work for you.

@ivannp
Copy link
Author

ivannp commented Dec 4, 2018

On 18.04 I tracked the segfault down to a problem with tracking the number of threads and allocated structures.

At the moment I don't need the dds portion of redeal, I am trying to see how feasible is to move my old deal scripts (a lot) to python. If things still don't work, I will deal with it once I get to the dds functionality.

@ivannp ivannp closed this as completed Dec 4, 2018
@anntzer
Copy link
Owner

anntzer commented Dec 4, 2018

Thanks for opening the PR on the dds repo, feel free to ping me when they merge it so that I update the version here as well.

@gkby79
Copy link

gkby79 commented Jun 28, 2022

I think the threading checks go wrong when several copies of the library are loaded and SetMaxThreads is called more than once - in particular, I had them loaded once from ddstable and once from redeal, and it didn't work, which may or may not be your use-case. If I explicitly load each of the libraries one by one and call SetMaxThreads twice it fails

DLL = ctypes.CDLL

Fails:

dll_path1 = "[snip]/ddstable/libdds.so"
dll_path2 = "[snip]/redeal/libdds.so"
dll1 = DLL(dll_path1)
dll2 = DLL(dll_path2)
dll1.SetMaxThreads(0)
dll2.SetMaxThreads(0)

Also fails:

dll_path1 = "[snip]/ddstable/libdds.so"
dll_path2 = "[snip]/ddstable/libdds.so"
dll1 = DLL(dll_path1)
dll2 = DLL(dll_path2)
dll1.SetMaxThreads(0)
dll2.SetMaxThreads(0)

Works:

dll_path1 = "[snip]/ddstable/libdds.so"
dll_path2 = "[snip]/ddstable/libdds.so"
dll1 = DLL(dll_path1)
dll2 = DLL(dll_path2)
dll1.SetMaxThreads(0)

@anntzer
Copy link
Owner

anntzer commented Jun 28, 2022

This looks like a bug in dds itself, and unrelated to redeal itself? You should probably report this to https://github.com/dds-bridge/dds.

@gkby79
Copy link

gkby79 commented Jun 28, 2022

Yes I think so, I reported it to the DDS list

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

3 participants