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

Zeromq 4.3.2 is not linked against libsodium on Windows #12031

Closed
chrisjbillington opened this issue Sep 10, 2020 · 5 comments
Closed

Zeromq 4.3.2 is not linked against libsodium on Windows #12031

chrisjbillington opened this issue Sep 10, 2020 · 5 comments

Comments

@chrisjbillington
Copy link

A problem previously resolved in #515 has regressed, and the Windows zeromq package no longer makes use of libsodium. This means zeromq CURVE encryption is very slow, and, according to the zeromq developers, should not be used in production as the fallback tweetnacl is not audited or maintained.

Copy-pasting my comment from issue #515, which it seems hasn't been seen (feel free to re-open that issue and close this one if appropriate):


This has regressed, I am once again seeing slow crypto in pyzmq as shipped by Anaconda in Windows. It looks like the zeromq package is no longer being built with libsodium on Windows as of 4.3.2. Here is a test script that prints dlls from the <prefix>\Library directory loaded into the process when pyzmq has been imported. It only prints libzmq.

import os
import psutil
import zmq
for dll in psutil.Process(os.getpid()).memory_maps():
    if 'Library' in dll.path:
        print(dll.path)
(base) C:\Users\bilbo\Documents\Scratch>python libcheck.py
pyzmq version: 19.0.1
zmq version: 4.3.2
C:\Users\bilbo\miniconda3\Library\bin\libzmq-mt-4_3_2.dll

But after downgrading to zeromq 4.3.1 libsodium is listed as well:

click to see output of downgrade command
(base) C:\Users\bilbo\Documents\Scratch>conda install zeromq==4.3.1
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\bilbo\miniconda3

  added / updated specs:
    - zeromq==4.3.1


The following packages will be DOWNGRADED:

  libsodium                               1.0.18-h62dcd97_0 --> 1.0.16-h9d3ae62_0
  pyzmq                               19.0.1-py38ha925a31_1 --> 18.1.1-py38ha925a31_0
  zeromq                                   4.3.2-ha925a31_2 --> 4.3.1-h33f27b4_3


Proceed ([y]/n)?

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
## Package Plan ##

  environment location: C:\Users\bilbo\miniconda3

  added / updated specs:
    - zeromq==4.3.1


The following packages will be DOWNGRADED:

  libsodium                               1.0.18-h62dcd97_0 --> 1.0.16-h9d3ae62_0
  pyzmq                               19.0.1-py38ha925a31_1 --> 18.1.1-py38ha925a31_0
  zeromq                                   4.3.2-ha925a31_2 --> 4.3.1-h33f27b4_3


Proceed ([y]/n)?

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(base) C:\Users\bilbo\Documents\Scratch>python zmq_crypto.py
Python Version: 3.8.3 (default, May 19 2020, 06:50:17) [MSC v.1916 64 bit (AMD64)]
Platform: win32
pyzmq version: 18.1.1
zmq version: 4.3.1
time to encrypt and send 100MB: 0.8667018413543701 s
(base) C:\Users\bilbo\Documents\Scratch>python 18.py
pyzmq version: 18.1.1
zmq version: 4.3.1
C:\Users\bilbo\miniconda3\Library\bin\libsodium.dll
C:\Users\bilbo\miniconda3\Library\bin\libzmq-mt-4_3_1.dll

And this lines up with the observed crypto speed, being slower when lisodium is not loaded.

@mingwandroid
Copy link

Thanks for the report @chrisjbillington. I'll bring it up with the team.

@mingwandroid
Copy link

Confirmed:

$ ntldd /opt/conda/pkgs/zeromq-4.3.2-ha925a31_2/Library/bin/libzmq.dll
        WS2_32.dll => C:\WINDOWS\SYSTEM32\WS2_32.dll (0x0000000000d10000)
        IPHLPAPI.DLL => C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL (0x00000000001a0000)
        KERNEL32.dll => C:\WINDOWS\SYSTEM32\KERNEL32.dll (0x0000000000e80000)
        ADVAPI32.dll => C:\WINDOWS\SYSTEM32\ADVAPI32.dll (0x0000000000e80000)
        MSVCP140.dll => C:\WINDOWS\SYSTEM32\MSVCP140.dll (0x0000000000e80000)
        VCRUNTIME140.dll => C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll (0x00000000001a0000)

@mingwandroid
Copy link

Please test @chrisjbillington

@mingwandroid
Copy link

(in ten minutes once the upload finishes)

@chrisjbillington
Copy link
Author

Brilliant, can confirm I have fast crypto once more.

Thanks very much!

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