-
Notifications
You must be signed in to change notification settings - Fork 51
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
SIGSEGV
in asyncTest
-derived scenario (also, in asyncTest
)
#518
Comments
Slightly less minimized version, showing the import ./asyncloop
import unittest2
proc connect(): Future[int] {.
async: (raw: true, raises: [ValueError]).} =
var retFuture = newFuture[int]("stream.transport.connect")
retFuture.fail(newException(ValueError,
"connect local address domain is not equal to target address domain"))
return retFuture
proc closeWait(transp: int): Future[void] {.async: (raw: true, raises: []).} =
var retFuture = newFuture[void]("stream.transport.join")
retFuture.complete()
return retFuture
type
TcpTransport = object
client: int
proc new(T: typedesc[TcpTransport]): T =
return default(TcpTransport)
method stop(self: TcpTransport) {.async.} =
discard await allFinished(@[self.client.closeWait()])
var stub: TcpTransport
suite "Tor transport":
setup:
stub = TcpTransport.new()
teardown:
waitFor stub.stop()
test "test start and dial using ipv4":
# asyncTest
waitFor((
proc() {.async.} =
discard await connect()
)()) But see above, |
The problem is not in |
I could also confirm that this (asyncdispatch version) import asyncdispatch
proc t(): Future[int] =
var retFuture = newFuture[int]("")
retFuture.fail(newException(ValueError, ""))
return retFuture
proc m(transp: int): Future[void] =
var retFuture = newFuture[void]("")
retFuture.complete()
return retFuture
proc p(self: int) {.async.} =
await self.m()
try:
defer: waitFor p(0) # teardown
waitFor((proc() {.async.} = discard await t())()) # asyncTest
except CatchableError:
discard is working |
simplified: import chronos # only depends on asyncloop's transitive closure
proc t(): Future[void] =
var retFuture = newFuture[void]("")
retFuture.fail(newException(ValueError, ""))
return retFuture
proc m(transp: int): Future[void] =
var retFuture = newFuture[void]("")
retFuture.complete()
return retFuture
proc p(self: int) {.async.} = await self.m()
try:
try:
waitFor(t()) # asyncTest
finally:
waitFor p(0) # teardown
except CatchableError:
discard |
Upstream bug: nim-lang/Nim#23390 |
Across all of Nim 1.6 refc and Nim 2.0 and devel refc and ORC:
Nim versions:
And this does trigger with the Chronos commit in
nimbus-eth2
, as well as the one one gets from cloning this repo in a default way.The text was updated successfully, but these errors were encountered: