summary refs log tree commit diff stats
path: root/tests/arc/tasyncorc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/tasyncorc.nim')
-rw-r--r--tests/arc/tasyncorc.nim26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/arc/tasyncorc.nim b/tests/arc/tasyncorc.nim
new file mode 100644
index 000000000..63703b559
--- /dev/null
+++ b/tests/arc/tasyncorc.nim
@@ -0,0 +1,26 @@
+discard """
+  output: '''230000'''
+  cmd: '''nim c --gc:orc -d:useMalloc $file'''
+  valgrind: "leaks"
+"""
+
+# bug #14402
+
+import asynchttpserver, asyncdispatch, httpclient, strutils
+
+proc cb(req: Request) {.async, gcsafe.} =
+  const html = " ".repeat(230000)
+  await req.respond(Http200, html)
+
+var server = newAsyncHttpServer()
+asyncCheck server.serve(Port(8080), cb)
+
+proc test {.async.} =
+  var
+    client = newAsyncHttpClient()
+    resp = await client.get("http://localhost:8080")
+
+  let x = (await resp.body).len
+  echo x # crash
+
+waitFor test()