summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-07-08 08:21:55 +0200
committerGitHub <noreply@github.com>2020-07-08 08:21:55 +0200
commit87f6a9592cbbace5e8f0d647841b4490bb7c0f1f (patch)
tree88873df2a2c2337199397b93f367e1511876120a /tests/arc
parente82a14b2735e58a4230d79820465753e2592cd2b (diff)
downloadNim-87f6a9592cbbace5e8f0d647841b4490bb7c0f1f.tar.gz
fixes #14402 (#14908)
* fixes #14402

* added a test case
Diffstat (limited to 'tests/arc')
-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..56b8909b1
--- /dev/null
+++ b/tests/arc/tasyncorc.nim
@@ -0,0 +1,26 @@
+discard """
+  output: '''230000'''
+  cmd: '''nim c --gc:orc -d:useMalloc $file'''
+  valgrind: "true"
+"""
+
+# 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()