<< Back to previous view

[ASYNC-45] Creating a timeout channel with a double causes the timeout-daemon to die Created: 09/Dec/13  Updated: 19/Nov/18  Resolved: 12/Dec/13

Status: Closed
Project: core.async
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Ben Poweski Assignee: Timothy Baldridge
Resolution: Completed Votes: 0
Labels: None


I inadvertently passed a double to a timeout channel and discovered the following behavior using

user=> (require '[clojure.core.async :as a])
user=> (a/timeout 100.0)
#<ManyToManyChannel clojure.core.async.impl.channels.ManyToManyChannel@1009d11d>
user=> Exception in thread "clojure.core.async.timers/timeout-daemon" java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Long
at java.lang.Long.compareTo(Long.java:50)
at java.util.concurrent.ConcurrentSkipListMap.doRemove(ConcurrentSkipListMap.java:1064)
at java.util.concurrent.ConcurrentSkipListMap.remove(ConcurrentSkipListMap.java:1896)
at clojure.core.async.impl.timers$timeout_worker.invoke(timers.clj:61)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:722)

user=> (.isAlive clojure.core.async.impl.timers/timeout-daemon)

Comment by Timothy Baldridge [ 12/Dec/13 10:32 PM ]

Fixed in master, added `:pre [(integer? msec)]` to timeout.

Comment by Rich Hickey [ 13/Dec/13 7:24 AM ]

I'd prefer we type hint ^long vs use a precondition

Generated at Sat Mar 23 09:42:17 CDT 2019 using JIRA 4.4#649-r158309.