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

Error: unhandled exception: cannot read from stream with --passl:-laws-cpp-sdk-core #7

Open
timotheecour opened this issue Aug 14, 2020 · 13 comments

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Aug 14, 2020

when true: # D20200814T190741
  import pkg/anonimongo
  import std/sha1
  let uriserver = "mongodb+srv://myuser:[email protected]/admin?ssl=true"
  var mongo = newMongo(uri = uriserver, poolconn = 2)
  mongo.slaveOk
  doAssert waitfor mongo.connect
nim cpp -r -d:ssl main.nim # works
nim cpp -r -d:ssl --passl:-laws-cpp-sdk-core main.nim # fails
  # see error log below

note:

  • I'm on OSX
  • I need -laws-cpp-sdk-core for the rest of my application
  • that's installed through brew install aws-sdk-cpp
    (aws-sdk-cpp 1.7.290, but also after brew upgrade aws-sdk-cpp to install latest 1.8.20)
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624) poll
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365) runOnce
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208) processPendingCallbacks
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23) sendOpsNimAsyncContinue
/Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/utils.nim(33) sendOpsIter
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(248) getReply
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(26) getReplyNimAsyncContinue
/Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/wire.nim(172) getReplyIter
/Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/bson.nim(103) msgHeaderFetch
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/streams.nim(620) readInt32
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/streams.nim(411) read
[[reraised from:
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624) poll
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365) runOnce
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208) processPendingCallbacks
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(26) sendOpsNimAsyncContinue
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275) sendOpsIter
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383) read
]]
[[reraised from:
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624) poll
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365) runOnce
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208) processPendingCallbacks
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(26) sendOpsNimAsyncContinue
/Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/utils.nim(30) sendOpsIter
]]
[[reraised from:
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624) poll
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365) runOnce
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208) processPendingCallbacks
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23) handshakeNimAsyncContinue
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275) handshakeIter
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383) read
]]
[[reraised from:
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624) poll
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365) runOnce
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208) processPendingCallbacks
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23) connectNimAsyncContinue
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275) connectIter
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383) read
]]
[[reraised from:
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1934) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383) read
]]
Error: unhandled exception: cannot read from stream
Async traceback:
  /Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217)           t11095
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932)   waitFor
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624)   poll
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365)   runOnce
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208)    processPendingCallbacks
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23)        sendOpsNimAsyncContinue
  /Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/utils.nim(33) sendOpsIter
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(248)       getReply
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(26)        getReplyNimAsyncContinue
  /Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/wire.nim(172) getReplyIter
  /Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/bson.nim(103) msgHeaderFetch
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/streams.nim(620)          readInt32
  /Users/timothee/git_clone/nim/Nim_devel/lib/pure/streams.nim(411)          read
  #[
    /Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217)           t11095
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932)   waitFor
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624)   poll
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365)   runOnce
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208)    processPendingCallbacks
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(26)        sendOpsNimAsyncContinue
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275)       sendOpsIter
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383)     read
  ]#
  #[
    /Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217)           t11095
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932)   waitFor
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624)   poll
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365)   runOnce
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208)    processPendingCallbacks
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(26)        sendOpsNimAsyncContinue
    /Users/timothee/git_clone/nim/anonimongo/src/anonimongo/core/utils.nim(30) sendOpsIter
  ]#
  #[
    /Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217)           t11095
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932)   waitFor
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624)   poll
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365)   runOnce
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208)    processPendingCallbacks
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23)        handshakeNimAsyncContinue
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275)       handshakeIter
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383)     read
  ]#
  #[
    /Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217)           t11095
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932)   waitFor
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624)   poll
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365)   runOnce
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208)    processPendingCallbacks
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23)        connectNimAsyncContinue
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275)       connectIter
    /Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383)     read
  ]#
Exception message: cannot read from stream
Exception type: [IOError]
@mashingan
Copy link
Owner

......
.....
#[
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11095.nim(217) t11095
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1932) waitFor
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1624) poll
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(1365) runOnce
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncdispatch.nim(208) processPendingCallbacks
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(23) connectNimAsyncContinue
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncmacro.nim(275) connectIter
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/asyncfutures.nim(383) read
]#
Exception message: cannot read from stream
Exception type: [IOError]

This error message usually happened when connecting to SSL/TLS enabled server but the socket is trying to connect without SSL/TLS context.
A wild guess, perhaps some MACRO in aws-sdk-cpp lib which unexpectedly disabling the TLS/SSL dependency?

Could you pull again the fix-ssl-connections branch? I added guard by throwing error when trying to connect with SSL without enabling SSL dependency.
mongodb+srv is implicitly using SSL/TLS connection so try to omit the option ssl=true and try adding the readPreferences=secondary or readPreferences=secondaryPreferred too.
I tried it and had no problem but just in case I missed something.

I did some change with newMongo signature, it's now:

let uriserver = "mongodb+srv://myuser:[email protected]/admin?ssl=true"
var mongo = newMongo(MultiUri uriserver, poolconn = 2)
mongo.slaveOk
doAssert waitfor mongo.connect

MultiUri is simply distinct string to avoid ambiguous newMongo proc invocation.

@timotheecour
Copy link
Contributor Author

Could you pull again the fix-ssl-connections branch?

I did; it shows the same error as in top post when I compile with -d:ssl, and does indeed show an informative error when I don't pass -d:ssl.

try to omit the option ssl=true and try adding the readPreferences=secondary or readPreferences=secondaryPreferred too.

I tried both removing ssl=true, adding readPreferences=secondary, adding readPreferences=secondaryPreferred, or removing and adding one, it didn't help.

I tried it and had no problem but just in case I missed something.

did you try with --passl:-laws-cpp-sdk-core ?
I don't know if this is specific to OSX (for testing on OSX without a mac see https://www.macincloud.com/)

@mashingan
Copy link
Owner

My bad, I haven't tested with the -laws-cpp-sdk-core.

@timotheecour
Copy link
Contributor Author

timotheecour commented Aug 15, 2020

looks like it happens with all the aws-cpp-sdk-* libraries ; after playing around a bit more with otool -L (linux's ldd) to figure out whether a dependent library was responsible, I found this:

I'm getting the same error with: --passl:-lcurl
and then if I do otool -L /usr/lib/libcurl.4.dylib it points to /usr/lib/libssl.46.dylib, and I also get the same error with: --passl:/usr/lib/libssl.46.dylib (note that I dont' get this error if I link the nim program against other libraries)

@mashingan
Copy link
Owner

mashingan commented Aug 15, 2020

This is the error after I linked it to libaws-cpp-sdk-core.so

/home/user/dev/nim/anonimongo/src/anonimongo/core/types.nim(328) newMongo
/home/user/dev/nim/anonimongo/src/anonimongo/core/types.nim(406) newMongo
/home/user/dev/nim/anonimongo/src/anonimongo/core/types.nim(235) handleSsl
/home/user/dev/nim/anonimongo/src/anonimongo/core/types.nim(188) setSsl
/home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/net.nim(567) newContext
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

This is indeed related to tls/ssl.


It failed here newCtx = SSL_CTX_new(SSLv23_method()).

Since it's calling directly the openssl shared lib, perhaps it has to do with the shared lib itself, IDK though precisely what to observe here, whether it's the openssl or just aws-cpp-sdk that broke the ssl.

@mashingan
Copy link
Owner

mashingan commented Aug 15, 2020

I got some interesting error message after adding for choosing the SSL/TLS protocol version

error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
Async traceback:
  /home/user/dev/nim/insert_to_atlas.nim(15)
 insert_to_atlas
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(1886) waitFor
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(1576) poll
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(1340) runOnce
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(210)
 processPendingCallbacks
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncmacro.nim(37)
 connectNimAsyncContinue
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncnet.nim(256)
 connectIter
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncnet.nim(205)
 getSslError
  /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/net.nim(476)
 raiseSSLError
  #[
    /home/user/dev/nim/insert_to_atlas.nim(15)
   insert_to_atlas
    /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(1886) waitFor
    /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(1576) poll
    /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(1340) runOnce
    /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncdispatch.nim(210)  processPendingCallbacks
    /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncmacro.nim(34)
   connectNimAsyncContinue
    /home/user/dev/nim/anonimongo/src/anonimongo/core/pool.nim(75)
   connectIter
    /home/user/.choosenim/toolchains/nim-1.2.0/lib/pure/asyncfutures.nim(383)   read
  ]#
Exception message: error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
Exception type:
Cannot connect to mongo atlas

After a bit of search, maybe this is related to TLSv1.0, TLSv1.1 and TLSv1.2 ref


correction, it seems not really related.

@timotheecour
Copy link
Contributor Author

Since it's calling directly the openssl shared lib, perhaps it has to do with the shared lib itself, IDK though precisely what to observe here, whether it's the openssl or just aws-cpp-sdk that broke the ssl.

  • see my note in Error: unhandled exception: cannot read from stream with --passl:-laws-cpp-sdk-core #7 (comment), otool -L (linux' ldd) shows that -laws-cpp-sdk-core depends on -lcurl (which gives same error) which itself depends on /usr/lib/libssl.46.dylib (which also gives same error), so it's not aws-cpp-sdk directly but it's really related to ssl lib that it depends on.

  • see also nim options to select ssl, eg: -d:sslVersion:44, to debug eg -d:nimDebugDlOpen, but I wasn't able to make progress with those

@mashingan
Copy link
Owner

So, this is kinda weird and I accidentally able to compile and running it fine, but by editing this part

-newCtx = SSL_CTX_new(SSLv23_method())
+newCtx = SSL_CTX_new(TLS_method())

It's mentioned here, openssl manpage, that SSLv23_method is deprecated in favor of TLS_method.

I tested it on Debian Stretch with libaws-cpp-sdk-core.so was built from the github source.

Checked with readelf -d insertAtlas yield

Dynamic section at offset 0x141d90 contains 32 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libaws-cpp-sdk-core.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x3798
 0x000000000000000d (FINI)               0x114480
 0x0000000000000019 (INIT_ARRAY)         0x341d30
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x341d38
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x298
 0x0000000000000005 (STRTAB)             0xb28
 0x0000000000000006 (SYMTAB)             0x2e8
 0x000000000000000a (STRSZ)              1302 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x342000
 0x0000000000000002 (PLTRELSZ)           1584 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x3168
 0x0000000000000007 (RELA)               0x11d0
 0x0000000000000008 (RELASZ)             8088 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffb (FLAGS_1)            Flags: PIE
 0x000000006ffffffe (VERNEED)            0x10f0
 0x000000006fffffff (VERNEEDNUM)         5
 0x000000006ffffff0 (VERSYM)             0x103e
 0x000000006ffffff9 (RELACOUNT)          323
 0x0000000000000000 (NULL)               0x0

With Nim compilation built option:

nim cpp -r -d:ssl \
      --passC:-L$HOME/dev/AWSSDK/lib \
      --passL:-L$HOME/dev/AWSSDK/lib \
      --passL:-laws-cpp-sdk-core \
      insertAtlas.nim

with snippet Nim code

var mongo = newMongo(
  MultiUri "mongodb+srv://user:[email protected]/admin?retryWrites=true&w=majority&readPreferences=secondaryPreferred",
  poolconn = 2,
  dnsserver = "192.168.18.1")

mongo.slaveOk

# the rest is same

My case was a bit different, that the net.newContext proc returning nil so it was crashed when creating TLS/SSL context. See if editing the above should solve the SSL context on mac too.

@timotheecour
Copy link
Contributor Author

i think i got something to work, but using a different approach from your above suggestion (and without changing SSL_CTX_new call):

nim cpp -d:ssl --dynlibOverride:ssl -d:openssl10 --passl:/usr/lib/libcrypto.44.dylib --passl:/usr/lib/libssl.44.dylib main.nim

need to run more tests though

My case was a bit different

indeed, our failures might differ; in my case I'm matching the ssl lib used in nim to match the one awslsdk-cpp depends on by way of -lcurl

@mashingan
Copy link
Owner

in my case I'm matching the ssl lib used in nim to match

Did you add the mongo.close() before quitting the test code?
This worked until tried to close the Mongo, which boiled to the failure to close the socket with SSL context.

*** Error in `/home/user/dev/insertAtlas': free(): invalid pointer: 0x00007ff1880e10c8 ***

This is abbreviated error message, the actual was printing all pointer redirection from openssl ERR_error_code and ERR_get_string.

I tried to debug and add looping to wait the context socket to be shutdown, but the operation hanged there.
Also could you try to patch the SSLv23_method to TLS_method above ? Just to see whether it works or not, after that you can revert it back to original one.
If it works I'll add the specific workaround for creating the context to not depend on net.newContext.

@timotheecour
Copy link
Contributor Author

Did you add the mongo.close() before quitting the test code?

yes, following does work for me:

nim r -d:ssl --dynlibOverride:ssl -d:openssl10 --passl:/usr/lib/libcrypto.44.dylib --passl:/usr/lib/libssl.44.dylib --passl:-laws-cpp-sdk-core $timn_D/tests/nim/all/t11095.nim

with 44 explained by running otool -L /usr/local/Cellar/aws-sdk-cpp/1.8.20/lib/libaws-cpp-sdk-core.dylib and otool -L /usr/lib/libcurl.4.dylib on my particular system

when true:
  import pkg/anonimongo
  import std/sha1
  let uriserver = "mongodb+srv://user:[email protected]/admin"
  proc main() =
    var mongo = newMongo(MultiUri uriserver, poolconn = 2)
    mongo.slaveOk
    doAssert waitfor mongo.connect
    doAssert waitfor mongo.authenticate[:SHA1Digest]
    defer:
      close mongo
    var coll = mongo["test"]["col1"]
    let currNDoc = waitfor coll.count()
    echo currNDoc
  main()

could you try to patch the SSLv23_method to TLS_method above ?

haven't tried yet

@timotheecour
Copy link
Contributor Author

Also could you try to patch the SSLv23_method to TLS_method above ? Just to see whether it works or not, after that you can revert it back to original one.

that one did not work:
nim cpp --lib:lib -r -d:ssl --passl:-laws-cpp-sdk-core $timn_D/tests/nim/all/t11095.nim

Exception message: cannot read from stream

so the only thing that works for me is what I described above #7 (comment)

Checked with readelf -d insertAtlas yield

note that nim's {importc} loads libraries using dlopen or similar so readelf -d insertAtlas would not pickup libraries loaded that way.

@mashingan
Copy link
Owner

Since this issue is specific to the openssl version, I'll leave this issue open as the fix should be in openssl wrapper lib.

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

2 participants