Skip to content
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

Websocket failure #75

Closed
benbrittain opened this issue Sep 18, 2014 · 13 comments
Closed

Websocket failure #75

benbrittain opened this issue Sep 18, 2014 · 13 comments

Comments

@benbrittain
Copy link

I tried setting up sente myself, realized nothing was working, then ran the example. It still didn't work for some reason.

Chromes error message is more descriptive than FFx for the bug.

WebSocket connection to 'ws://localhost:39432/chsk' failed: One or more reserved bits are on:    reserved1 = 1, reserved2 = 0, reserved3 = 0 main.js:46260
WebSocket error: [object Event] main.js:44843
Chsk is closed: will try reconnect (8). 
@benbrittain
Copy link
Author

Since the example also randomly does AJAX, here is that error as well. It gives a much more informative stack trace clj side

Thu Sep 18 18:46:31 EDT 2014 [worker-3] ERROR - GET /chsk
java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentList
    at clojure.lang.RT.contains(RT.java:769)
    at clojure.core$contains_QMARK_.invoke(core.clj:1417)
    at taoensso.sente$make_channel_socket_BANG_$connect_uid_BANG___19132$fn__19134.invoke(sente.cljx:323)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:628)
    at taoensso.encore$swap_in_BANG_.doInvoke(encore.cljx:540)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at taoensso.sente$make_channel_socket_BANG_$connect_uid_BANG___19132.invoke(sente.cljx:313)
    at taoensso.sente$make_channel_socket_BANG_$fn__19371.invoke(sente.cljx:548)
    at example.my_app$fn__20023.invoke(my_app.cljx:110)
    at compojure.core$make_route$fn__10713.invoke(core.clj:100)
    at compojure.core$if_route$fn__10701.invoke(core.clj:46)
    at compojure.core$if_method$fn__10694.invoke(core.clj:31)
    at compojure.core$routing$fn__10719.invoke(core.clj:113)
    at clojure.core$some.invoke(core.clj:2560)
    at compojure.core$routing.doInvoke(core.clj:113)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:628)
    at compojure.core$routes$fn__10723.invoke(core.clj:118)
    at ring.middleware.flash$wrap_flash$fn__10939.invoke(flash.clj:35)
    at ring.middleware.anti_forgery$wrap_anti_forgery$fn__11802.invoke(anti_forgery.clj:90)
    at ring.middleware.session$wrap_session$fn__11604.invoke(session.clj:98)
    at ring.middleware.keyword_params$wrap_keyword_params$fn__11735.invoke(keyword_params.clj:35)
    at ring.middleware.nested_params$wrap_nested_params$fn__11777.invoke(nested_params.clj:84)
    at ring.middleware.multipart_params$wrap_multipart_params$fn__11873.invoke(multipart_params.clj:118)
    at ring.middleware.params$wrap_params$fn__11892.invoke(params.clj:64)
    at ring.middleware.cookies$wrap_cookies$fn__11511.invoke(cookies.clj:156)
    at ring.middleware.absolute_redirects$wrap_absolute_redirects$fn__11946.invoke(absolute_redirects.clj:36)
    at ring.middleware.resource$wrap_resource$fn__11899.invoke(resource.clj:26)
    at ring.middleware.content_type$wrap_content_type$fn__10853.invoke(content_type.clj:30)
    at ring.middleware.not_modified$wrap_not_modified$fn__11931.invoke(not_modified.clj:44)
    at ring.middleware.x_headers$wrap_xss_protection$fn__10925.invoke(x_headers.clj:71)
    at ring.middleware.x_headers$wrap_frame_options$fn__10915.invoke(x_headers.clj:38)
    at ring.middleware.x_headers$wrap_content_type_options$fn__10920.invoke(x_headers.clj:53)
    at clojure.lang.Var.invoke(Var.java:379)
    at org.httpkit.server.HttpHandler.run(RingHandler.java:91)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(


@ptaoussanis
Copy link
Member

Hi Ben, thanks for the report. I'm struggling to reproduce this on my end.

Some questions (all in reference to the example project):

  • You're running the latest version of Sente ([com.taoensso/sente "1.1.0"])? Note that the README was incorrectly listing v1.0.0 as the most recent.
  • You're running the example project exactly as is, absolutely no modifications to project.clj or anything else?
  • What browser + version are you running?
  • Please run lein clean; lein cljsbuild clean and show me the output from lein deps :tree.

Will debug from there, thanks!

@benbrittain
Copy link
Author

Sure thing!

  • Sente 1.1.0
  • I just downloaded the example project, I threw in a cider plugin dep, but it's the same without.
    I tried with both chromium, and FFx 33.02a
(WARNING!!! version ranges found for:)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [org.clojure/clojure "[1.3.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [net.cgrand/regex "1.1.0"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [net.cgrand/parsley "0.9.1"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [net.cgrand/parsley "0.9.1"] -> [net.cgrand/regex "1.1.0"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
nil
 [clojure-complete "0.2.3" :exclusions [[org.clojure/clojure]]]
 [com.cemerick/austin "0.1.4"]
   [com.cemerick/piggieback "0.1.3"]
 [com.cemerick/clojurescript.test "0.3.1" :scope "test"]
 [com.cognitect/transit-clj "0.8.247"]
   [com.cognitect/transit-java "0.8.257"]
     [com.fasterxml.jackson.datatype/jackson-datatype-json-org "2.3.2"]
       [com.fasterxml.jackson.core/jackson-core "2.3.2"]
       [com.fasterxml.jackson.core/jackson-databind "2.3.2"]
         [com.fasterxml.jackson.core/jackson-annotations "2.3.0"]
     [org.apache.directory.studio/org.apache.commons.codec "1.8"]
       [commons-codec "1.8"]
     [org.msgpack/msgpack "0.6.10"]
       [com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
       [org.javassist/javassist "3.18.1-GA"]
 [com.cognitect/transit-cljs "0.8.188"]
   [com.cognitect/transit-js "0.8.723"]
 [com.keminglabs/cljx "0.4.0"]
   [org.clojars.trptcolin/sjacket "0.1.0.6"]
     [net.cgrand/parsley "0.9.1"]
     [net.cgrand/regex "1.1.0"]
   [org.clojure/core.match "0.2.0"]
   [watchtower "0.1.1"]
 [com.taoensso/encore "1.8.1"]
 [com.taoensso/timbre "3.3.1"]
   [io.aviso/pretty "0.1.12"]
 [expectations "2.0.9"]
   [junit "4.8.1"]
 [http-kit "2.1.19"]
 [org.clojure/clojure "1.7.0-alpha2"]
 [org.clojure/clojurescript "0.0-2322"]
   [com.google.javascript/closure-compiler "v20140625"]
     [args4j "2.0.26"]
     [com.google.code.findbugs/jsr305 "1.3.9"]
     [com.google.guava/guava "17.0"]
     [com.google.javascript/closure-compiler-externs "v20140625"]
     [com.google.protobuf/protobuf-java "2.5.0"]
     [org.json/json "20090211"]
   [org.clojure/data.json "0.2.3"]
   [org.clojure/google-closure-library "0.0-20140718-946a7d39"]
     [org.clojure/google-closure-library-third-party "0.0-20140718-946a7d39"]
   [org.mozilla/rhino "1.7R4"]
 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
   [org.clojure/tools.analyzer.jvm "0.1.0-beta12"]
     [org.clojure/core.memoize "0.5.6"]
       [org.clojure/core.cache "0.6.3"]
         [org.clojure/data.priority-map "0.0.2"]
     [org.clojure/tools.analyzer "0.1.0-beta12"]
     [org.ow2.asm/asm-all "4.1"]
 [org.clojure/test.check "0.5.9"]
 [org.clojure/tools.nrepl "0.2.3" :exclusions [[org.clojure/clojure]]]
 [org.clojure/tools.reader "0.8.8"]

@ptaoussanis
Copy link
Member

Yeah, I'm really struggling to get a reproduction of this. Have tried:

  • Chrome 37.0.2062.94 (Ajax + WebSockets),
  • Safari 7.0.6 (9537.78.2) (Ajax + WebSockets),
  • FireFox 32.0 (Ajax + WebSockets).

There's nothing at all unusual about your platform? You're not running this on Heroku or a remote server of some kind? Any browser plugins that may be interfering with your connections?

Does anything here ring any bells for you?

Could you show me your lein clean; lein cljsbuild clean; lein deps :tree output from the reference example dir? (the lein deps :tree output you've got there seems to be from the Sente dir, not the ref example).

You're running the reference example as lein start-dev?

What OS are you on?

The Ajax error you're seeing doesn't make sense to me unless you're actually manually modifying the connected-uids_ atom, but the ref example doesn't do that. There's only two places where this atom is modified internally, and both maintain uids as sets.

On the off-chance that you've somehow ended up with corrupt code, could you try delete the following dirs before lein clean; lein cljsbuild clean; lein start-dev in the ref example dir again?:
~/.m2/repository/http-kit/http-kit/
~/.m2/repository/com/taoensso/

This'll delete your Maven artefacts for http-kit and everything by me so that they'll be pulled in fresh again on the next lein startup.

Thanks a lot for your help debugging this.

@benbrittain
Copy link
Author

alright, exactly what I've done:

    rm -r ~/.m2/repository/http-kit
    rm -r ~/.m2/repository/com/taoensso
    cd workspace/sente/example-project
    lein clean; lein cljsbuild clean; lein start-dev

I'm generally a vim person, so maybe I've done something horrible with emacs here?

emacs
M-x cider-connect
(compile 'example.my-app)
(example.my-app/start!)

the lovely tree

(WARNING!!! version ranges found for:)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [org.clojure/clojure "[1.3.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [net.cgrand/regex "1.1.0"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [net.cgrand/parsley "0.9.1"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
([com.keminglabs/cljx "0.4.0"] -> [org.clojars.trptcolin/sjacket "0.1.0.6"] -> [net.cgrand/parsley "0.9.1"] -> [net.cgrand/regex "1.1.0"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [com.keminglabs/cljx "0.4.0" :exclusions [org.clojure/clojure]].)
nil
 [cider/cider-nrepl "0.7.0"]
   [cljs-tooling "0.1.3" :exclusions [[org.clojure/clojure]]]
   [compliment "0.1.3" :exclusions [[org.clojure/clojure]]]
   [org.clojure/java.classpath "0.2.0" :exclusions [[org.clojure/clojure]]]
   [org.clojure/tools.namespace "0.2.5" :exclusions [[org.clojure/clojure]]]
   [org.clojure/tools.trace "0.7.8" :exclusions [[org.clojure/clojure]]]
   [org.tcrawley/dynapath "0.2.3" :exclusions [[org.clojure/clojure]]]
 [clojure-complete "0.2.3" :exclusions [[org.clojure/clojure]]]
 [com.cemerick/austin "0.1.4"]
 [com.cognitect/transit-clj "0.8.247"]
   [com.cognitect/transit-java "0.8.257"]
     [com.fasterxml.jackson.datatype/jackson-datatype-json-org "2.3.2"]
       [com.fasterxml.jackson.core/jackson-core "2.3.2"]
       [com.fasterxml.jackson.core/jackson-databind "2.3.2"]
         [com.fasterxml.jackson.core/jackson-annotations "2.3.0"]
     [org.apache.directory.studio/org.apache.commons.codec "1.8"]
     [org.msgpack/msgpack "0.6.10"]
       [com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
       [org.javassist/javassist "3.18.1-GA"]
 [com.cognitect/transit-cljs "0.8.188"]
   [com.cognitect/transit-js "0.8.723"]
 [com.keminglabs/cljx "0.4.0"]
   [com.cemerick/piggieback "0.1.3"]
   [org.clojars.trptcolin/sjacket "0.1.0.6"]
     [net.cgrand/parsley "0.9.1"]
     [net.cgrand/regex "1.1.0"]
   [org.clojure/core.match "0.2.0"]
   [watchtower "0.1.1"]
 [com.taoensso/sente "1.1.0"]
   [com.taoensso/encore "1.8.1"]
 [com.taoensso/timbre "3.3.1"]
   [io.aviso/pretty "0.1.12"]
 [compojure "1.1.9"]
   [clout "1.2.0"]
   [org.clojure/tools.macro "0.1.0"]
   [ring/ring-core "1.3.1"]
     [clj-time "0.6.0"]
       [joda-time "2.2"]
     [commons-fileupload "1.3"]
     [commons-io "2.4"]
     [crypto-equality "1.0.0"]
     [crypto-random "1.2.0"]
     [ring/ring-codec "1.0.0"]
       [commons-codec "1.6"]
 [hiccup "1.0.5"]
 [http-kit "2.1.19"]
 [org.clojure/clojure "1.7.0-alpha2"]
 [org.clojure/clojurescript "0.0-2322"]
   [com.google.javascript/closure-compiler "v20140625"]
     [args4j "2.0.26"]
     [com.google.code.findbugs/jsr305 "1.3.9"]
     [com.google.guava/guava "17.0"]
     [com.google.javascript/closure-compiler-externs "v20140625"]
     [com.google.protobuf/protobuf-java "2.5.0"]
     [org.json/json "20090211"]
   [org.clojure/data.json "0.2.3"]
   [org.clojure/google-closure-library "0.0-20140718-946a7d39"]
     [org.clojure/google-closure-library-third-party "0.0-20140718-946a7d39"]
   [org.clojure/tools.reader "0.8.4"]
   [org.mozilla/rhino "1.7R4"]
 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
   [org.clojure/tools.analyzer.jvm "0.1.0-beta12"]
     [org.clojure/core.memoize "0.5.6"]
       [org.clojure/core.cache "0.6.3"]
         [org.clojure/data.priority-map "0.0.2"]
     [org.clojure/tools.analyzer "0.1.0-beta12"]
     [org.ow2.asm/asm-all "4.1"]
 [org.clojure/tools.nrepl "0.2.3" :exclusions [[org.clojure/clojure]]]
 [ring/ring-defaults "0.1.1"]
   [javax.servlet/servlet-api "2.5"]
   [ring/ring-anti-forgery "1.0.0"]
   [ring/ring-headers "0.1.0"]
   [ring/ring-ssl "0.2.1"]
 [ring "1.3.1"]
   [ring/ring-devel "1.3.1"]
     [clj-stacktrace "0.2.7"]
     [ns-tracker "0.2.2"]
   [ring/ring-jetty-adapter "1.3.1"]
     [org.eclipse.jetty/jetty-server "7.6

running this on a relatively standard linux box, 3.16.1-1-ARCH to be precise. I also suspected some sort of browser thing, which is why I tried a stock chromium... no luck.

when websocketing, the JS console

The connection to ws://localhost:37650/chsk was interrupted while the page was loading. main.js:46260
"WebSocket error: [object Event]" main.js:44843
"Chsk is closed: will try reconnect (1)."

when AJAXing, the JS console

"ClojureScript appears to have loaded correctly." main.js:44843
syntax error chsk:1
"Chsk is closed: will try reconnect (1)." main.js:44843
GET http://localhost:37650/chsk [HTTP/1.1 500 Internal Server Error 2ms]
syntax error chsk:1

the REPL

Sat Sep 20 10:33:11 EDT 2014 [worker-2] ERROR - GET /chsk
java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentList
    at clojure.lang.RT.contains(RT.java:769)
    at clojure.core$contains_QMARK_.invoke(core.clj:1417)
    at taoensso.sente$make_channel_socket_BANG_$connect_uid_BANG___19127$fn__19129.invoke(sente.cljx:323)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:628)
    at taoensso.encore$swap_in_BANG_.doInvoke(encore.cljx:540)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at taoensso.sente$make_channel_socket_BANG_$connect_uid_BANG___19127.invoke(sente.cljx:313)
    at taoensso.sente$make_channel_socket_BANG_$fn__19366.invoke(sente.cljx:497)
    at example.my_app$fn__20018.invoke(my_app.cljx:110)
    at compojure.core$make_route$fn__10708.invoke(core.clj:100)
    at compojure.core$if_route$fn__10696.invoke(core.clj:46)
    at compojure.core$if_method$fn__10689.invoke(core.clj:31)
    at compojure.core$routing$fn__10714.invoke(core.clj:113)
    at clojure.core$some.invoke(core.clj:2560)
    at compojure.core$routing.doInvoke(core.clj:113)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:628)
    at compojure.core$routes$fn__10718.invoke(core.clj:118)
    at ring.middleware.flash$wrap_flash$fn__10934.invoke(flash.clj:35)
    at ring.middleware.anti_forgery$wrap_anti_forgery$fn__11797.invoke(anti_forgery.clj:90)
    at ring.middleware.session$wrap_session$fn__11599.invoke(session.clj:98)
    at ring.middleware.keyword_params$wrap_keyword_params$fn__11730.invoke(keyword_params.clj:35)
    at ring.middleware.nested_params$wrap_nested_params$fn__11772.invoke(nested_params.clj:84)
    at ring.middleware.multipart_params$wrap_multipart_params$fn__11868.invoke(multipart_params.clj:118)
    at ring.middleware.params$wrap_params$fn__11887.invoke(params.clj:64)
    at ring.middleware.cookies$wrap_cookies$fn__11506.invoke(cookies.clj:156)
    at ring.middleware.absolute_redirects$wrap_absolute_redirects$fn__11941.invoke(absolute_redirects.clj:36)
    at ring.middleware.resource$wrap_resource$fn__11894.invoke(resource.clj:26)
    at ring.middleware.content_type$wrap_content_type$fn__10848.invoke(content_type.clj:30)
    at ring.middleware.not_modified$wrap_not_modified$fn__11926.invoke(not_modified.clj:44)
    at ring.middleware.x_headers$wrap_xss_protection$fn__10920.invoke(x_headers.clj:71)
    at ring.middleware.x_headers$wrap_frame_options$fn__10910.invoke(x_headers.clj:38)
    at ring.middleware.x_headers$wrap_content_type_options$fn__10915.invoke(x_headers.clj:53)
    at clojure.lang.Var.invoke(Var.java:379)
    at org.httpkit.server.HttpHandler.run(RingHandler.java:91)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Sorry about causing such problems! If there is any more info you need, lemme know.

ptaoussanis added a commit that referenced this issue Sep 21, 2014
@ptaoussanis
Copy link
Member

Sorry about causing such problems!

Absolutely no problem, if there's an issue - I'd like to figure it out: thank you for providing data for debugging!

If there is any more info you need, lemme know.

Still haven't been able to reproduce, and still no idea what the cause could be, unfortunately. Ignoring the WebSocket error for the moment since that could be related to http-kit #95.

The Ajax error you're seeing shouldn't be possible and is on Sente's side, so let's try tackle that first:

I've just uploaded [com.taoensso.debug/sente "1.1.1-SNAPSHOT"] (please note the .debug).

  1. Please grab a fresh copy of the new dev branch here which should include commit e06557a ("Temp: debug Websocket failure #75").
  2. Start the example project as usual (lein clean; lein cljsbuild clean; lein start-dev from the /example-project dir).
  3. Reload the example app in your browser until you get an :ajax connection (will say so in the js console).
  4. If you're still seeing an error, please get me your js console & server log (there'll be extra debug info this time).

Much appreciated!

@benbrittain
Copy link
Author

It was working. Then I authenticated and it broke?
Here is the log

nREPL server started on port 57475 on host 127.0.0.1 - nrepl://127.0.0.1:57475
(process:26026): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
2014-Sep-21 16:35:30 -0400 mars TRACE [taoensso.sente] - New WebSocket channel: nil (/0:0:0:0:0:0:0:1:33146<->/0:0:0:0:0:0:0:1:54968)
2014-Sep-21 16:35:30 -0400 mars TRACE [taoensso.sente] - conns_ change: {:ws {nil #{#<AsyncChannel /0:0:0:0:0:0:0:1:33146<->/0:0:0:0:0:0:0:1:54968>}}, :ajax {}}
2014-Sep-21 16:35:30 -0400 mars TRACE [taoensso.sente] - connected-uids_ change: taoensso.encore.Swapped@2a460b8f
2014-Sep-21 16:35:30 -0400 mars TRACE [taoensso.sente] - Handshake!
2014-Sep-21 16:35:30 -0400 mars TRACE [taoensso.sente] - Packing: (#<FlexiPacker taoensso.sente.packers.transit.FlexiPacker@25967e7f> nil [:chsk/handshake [nil "ad18CQOqRtopsYB9bCOlje7YPKimVXidj2/XOLQ4ZdXP71JBajP3z1IEu4CG+vklLgR+Ge8f7LTxc3cy"]]) -> -e[:chsk/handshake [nil "ad18CQOqRtopsYB9bCOlje7YPKimVXidj2/XOLQ4ZdXP71JBajP3z1IEu4CG+vklLgR+Ge8f7LTxc3cy"]]
2014-Sep-21 16:35:38 -0400 mars TRACE [taoensso.sente] - Unpacking: +e[[:example/button2 {:had-a-callback? "indeed"}] "ee3408"] -> [[:example/button2 {:had-a-callback? "indeed"}] "ee3408"]
2014-Sep-21 16:35:42 -0400 mars TRACE [taoensso.sente] - Unpacking: +e[[:example/button1 {:had-a-callback? "nope"}]] -> [[:example/button1 {:had-a-callback? "nope"}] nil]
2014-Sep-21 16:35:47 -0400 mars TRACE [taoensso.sente] - conns_ change: {:ws {}, :ajax {}}
Login request: {:user-id "tadaa", :csrf-token "ad18CQOqRtopsYB9bCOlje7YPKimVXidj2/XOLQ4ZdXP71JBajP3z1IEu4CG+vklLgR+Ge8f7LTxc3cy"}
2014-Sep-21 16:35:48 -0400 mars TRACE [taoensso.sente] - New WebSocket channel: tadaa (/0:0:0:0:0:0:0:1:33146<->/0:0:0:0:0:0:0:1:54970)
2014-Sep-21 16:35:48 -0400 mars TRACE [taoensso.sente] - conns_ change: {:ws {"tadaa" #{#<AsyncChannel /0:0:0:0:0:0:0:1:33146<->/0:0:0:0:0:0:0:1:54970>}}, :ajax {}}
Sun Sep 21 16:35:48 EDT 2014 [worker-1] ERROR - GET /chsk
java.lang.AssertionError: Assert failed: (set? ws)
    at taoensso.sente$make_channel_socket_BANG_$connect_uid_BANG___19148$fn__19150.invoke(sente.cljx:323)
    at taoensso.encore$swap_in_BANG_.invoke(encore.cljx:598)
    at taoensso.sente$make_channel_socket_BANG_$connect_uid_BANG___19148.invoke(sente.cljx:321)
    at taoensso.sente$make_channel_socket_BANG_$fn__19387.invoke(sente.cljx:517)
    at example.my_app$fn__20046.invoke(my_app.cljx:110)
    at compojure.core$make_route$fn__10678.invoke(core.clj:100)
    at compojure.core$if_route$fn__10666.invoke(core.clj:46)
    at compojure.core$if_method$fn__10659.invoke(core.clj:31)
    at compojure.core$routing$fn__10684.invoke(core.clj:113)
    at clojure.core$some.invoke(core.clj:2560)
    at compojure.core$routing.doInvoke(core.clj:113)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:628)
    at compojure.core$routes$fn__10688.invoke(core.clj:118)
    at ring.middleware.flash$wrap_flash$fn__10904.invoke(flash.clj:35)
    at ring.middleware.anti_forgery$wrap_anti_forgery$fn__11767.invoke(anti_forgery.clj:90)
    at ring.middleware.session$wrap_session$fn__11569.invoke(session.clj:98)
    at ring.middleware.keyword_params$wrap_keyword_params$fn__11700.invoke(keyword_params.clj:35)
    at ring.middleware.nested_params$wrap_nested_params$fn__11742.invoke(nested_params.clj:84)
    at ring.middleware.multipart_params$wrap_multipart_params$fn__11838.invoke(multipart_params.clj:118)
    at ring.middleware.params$wrap_params$fn__11857.invoke(params.clj:64)
    at ring.middleware.cookies$wrap_cookies$fn__11476.invoke(cookies.clj:156)
    at ring.middleware.absolute_redirects$wrap_absolute_redirects$fn__11911.invoke(absolute_redirects.clj:36)
    at ring.middleware.resource$wrap_resource$fn__11864.invoke(resource.clj:26)
    at ring.middleware.content_type$wrap_content_type$fn__10818.invoke(content_type.clj:30)
    at ring.middleware.not_modified$wrap_not_modified$fn__11896.invoke(not_modified.clj:44)
    at ring.middleware.x_headers$wrap_xss_protection$fn__10890.invoke(x_headers.clj:71)
    at ring.middleware.x_headers$wrap_frame_options$fn__10880.invoke(x_headers.clj:38)
    at ring.middleware.x_headers$wrap_content_type_options$fn__10885.invoke(x_headers.clj:53)
    at clojure.lang.Var.invoke(Var.java:379)
    at org.httpkit.server.HttpHandler.run(RingHandler.java:91)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
2014-Sep-21 16:35:49 -0400 mars TRACE [taoensso.sente] - New WebSocket channel: tadaa (/0:0:0:0:0:0:0:1:33146<->/0:0:0:0:0:0:0:1:54971)
2014-Sep-21 16:35:49 -0400 mars TRACE [taoensso.sente] - conns_ change: {:ws {"tadaa" #{#<AsyncChannel /0:0:0:0:0:0:0:1:33146<->/0:0:0:0:0:0:0:1:54971> #<AsyncChannel 0.0.0.0/0.0.0.0:33146<->null>}}, :ajax {}}
Sun Sep 21 16:35:49 EDT 2014 [worker-2] ERROR - GET /chsk
java.lang.AssertionError: Assert failed: (set? ws)

for the websockets

@ptaoussanis
Copy link
Member

Okay- we're getting somewhere!

2014-Sep-21 16:35:30 -0400 mars TRACE [taoensso.sente] - connected-uids_ change: taoensso.encore.Swapped@2a460b8f

This shouldn't be possible, and would explain the errors you're seeing for both WebSockets and Ajax. Let me dig into it and get back to you, I suspect I have all the info I need.

@ptaoussanis
Copy link
Member

Okay, so this appears to be an AOT issue caused by your (compile 'example.my-app) call.

You can confirm this and get Sente to run correctly by:

  1. Calling lein clean; lein cljsbuild clean; lein start-dev as usual.
  2. M-x, cider-load-current-buffer instead of your compile call. (cider-load-current-buffer is usu. bound to C-c C-k, I believe).

I expect that everything should work from there.

As to why the compile call is causing issues - I can't actually say, I'll need to continue digging. The AOT compile call is causing some odd behaviour against one of Sente's supporting lib's types:

(defrecord Swapped [new-val return-val])
(instance? Swapped (Swapped.  "foo" "bar")) ; true before + after compile
(instance? Swapped (->Swapped "foo" "bar")) ; true before compile, false after

I'll do some more digging to understand better what about the AOT compile call is actually causing issues, but in the meantime I'd suggest just avoiding the compile call. I'll update the example docs in the meantime to explain how to eval a namespace in the usual way for folks unfamiliar with emacs+cider.

Thanks again for your assistance debugging, and please let me know if this does/doesn't resolve all the issues you were seeing. Cheers! :-)

ptaoussanis added a commit that referenced this issue Sep 22, 2014
This reverts commit e06557a.
@ptaoussanis
Copy link
Member

Just updated [com.taoensso/sente "1.1.1-SNAPSHOT"] which I believe should work around the issue you've been seeing, even if you continue to use compile.

@ptaoussanis
Copy link
Member

Seems like this may actually be a bug with Clojure: https://groups.google.com/forum/#!topic/clojure/LaTS7OFh01Q, http://dev.clojure.org/jira/browse/CLJ-979

@ptaoussanis
Copy link
Member

Hey Ben, any follow-up on this?

@benbrittain
Copy link
Author

Ahh, sorry. It does indeed work! Thanks so much!

tobias pushed a commit to tobias/sente that referenced this issue Jan 29, 2015
tobias pushed a commit to tobias/sente that referenced this issue Jan 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants