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

smtp module doesn't support threads. #9728

m4d3bug opened this Issue Nov 16, 2018 · 1 comment


None yet
3 participants
Copy link

m4d3bug commented Nov 16, 2018

changed it from

when not defined(ssl):
  type PSSLContext = ref object
  let defaultSSLContext: PSSLContext = nil
  let defaultSSLContext = newContext(verifyMode = CVerifyNone)


var defaultSSLContext {.threadvar.}: SSLContext
when not defined(ssl):
  type PSSLContext = ref object
  defaultSSLContext: PSSLContext = nil
  defaultSSLContext = newContext(verifyMode = CVerifyNone)

but when it run the program still got this error

Traceback (most recent call last)
cmpthreads.nim(51)       worker
server.nim(165)          respond
server.nim(122)          process
login.nim(354)           getCode
email.nim(48)            sendEmail
smtp.nim(121)            newSmtp
net.nim(645)             wrapSocket
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

@m4d3bug m4d3bug changed the title Some smtp problem cause crash smtp module doesn't support threads. Nov 16, 2018


This comment has been minimized.

Copy link

Araq commented Nov 16, 2018

That's not how thread local storage works. You need to init it within the thread as Nim's error message clearly says.

@Araq Araq closed this in 4929f74 Nov 16, 2018

narimiran added a commit that referenced this issue Jan 3, 2019

fixes #9728
(cherry picked from commit 4929f74)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment