aleph

kwladyka 2019-01-11T12:26:07.014600Z

((:close foo))

Jan 11, 2019 1:16:20 PM io.netty.util.concurrent.DefaultPromise notifyListener0
WARNING: An exception was thrown by aleph.netty$wrap_future$reify__16507.operationComplete()
java.lang.ExceptionInInitializerError
	at manifold.deferred.Deferred.success(deferred.clj:398)
	at manifold.deferred$success_BANG_.invokeStatic(deferred.clj:243)
	at manifold.deferred$success_BANG_.invoke(deferred.clj:240)
	at aleph.netty$wrap_future$reify__16507.operationComplete(netty.clj:199)
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
	at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:94)
	at io.netty.util.concurrent.MultithreadEventExecutorGroup$1.operationComplete(MultithreadEventExecutorGroup.java:117)
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
	at io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:33)
	at io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:435)
	at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:248)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: clojure/lang/PersistentArrayMap
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
	at clojure.lang.RT.classForName(RT.java:2207)
	at clojure.lang.RT.classForName(RT.java:2216)
	at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:324)
	at clojure.lang.LispReader$EvalReader.invoke(LispReader.java:1322)
	at clojure.lang.LispReader$DispatchReader.invoke(LispReader.java:853)
	at clojure.lang.LispReader.read(LispReader.java:285)
	at clojure.lang.LispReader.read(LispReader.java:220)
	at clojure.lang.LispReader.access$200(LispReader.java:41)
	at clojure.lang.LispReader$MetaReader.invoke(LispReader.java:954)
	at clojure.lang.LispReader.read(LispReader.java:285)
	at clojure.lang.LispReader.readDelimitedList(LispReader.java:1398)
	at clojure.lang.LispReader$ListReader.invoke(LispReader.java:1243)
	at clojure.lang.LispReader.read(LispReader.java:285)
	at clojure.lang.LispReader.read(LispReader.java:220)
	at clojure.lang.LispReader.access$200(LispReader.java:41)
	at clojure.lang.LispReader$EvalReader.invoke(LispReader.java:1301)
	at clojure.lang.LispReader$DispatchReader.invoke(LispReader.java:853)
	at clojure.lang.LispReader.read(LispReader.java:285)
	at clojure.lang.LispReader.read(LispReader.java:216)
	at clojure.lang.LispReader.read(LispReader.java:205)
	at clojure.lang.RT.readString(RT.java:1874)
	at clojure.lang.RT.readString(RT.java:1869)
	at manifold.deferred.Deferred$fn__3629.<clinit>(deferred.clj:398)
	... 16 more
Any way to fix it?

kwladyka 2019-01-11T12:26:39.014900Z

{org.clojure/clojure {:mvn/version "1.10.0"}
        yada {:mvn/version "1.2.16"}
        aleph {:mvn/version "0.4.6"}
        bidi {:mvn/version "2.1.5"}
        integrant {:mvn/version "0.7.0"}}

kwladyka 2019-01-11T12:27:26.015300Z

java --version                                                                                  4.5m  Thu Dec 27 21:59:03 2018
java 11.0.1 2018-10-16 LTS

2019-01-11T12:27:42.015700Z

I wanted to ask what is in foo, but i see there is a Caused by: java.lang.ClassNotFoundException: clojure/lang/PersistentArrayMap Not sure what to do about this

kwladyka 2019-01-11T12:28:12.016100Z

foo is (yada/listener handler aleph-options) which return fn to close server

2019-01-11T12:28:38.016800Z

Ah I see. I don't know sorry

kwladyka 2019-01-11T12:29:13.017500Z

But as I understand it is aleph bug and this fn is what aleph return to close the server

kwladyka 2019-01-11T12:29:30.017800Z

no problem, thank you for trying

kwladyka 2019-01-11T12:29:41.018100Z

it could be something about java version maybe

2019-01-11T12:30:20.018900Z

You could try to start a normal aleph server and close it to see if that works? For us this works (on different clojure and java) version. But if that does work it might be yada related?

kwladyka 2019-01-11T12:30:54.019300Z

hmm I have to figure out how to start / close aleph without yada 😉

kwladyka 2019-01-11T12:31:24.019600Z

give me a sec

2019-01-11T12:31:27.019800Z

From the readme

(require '[aleph.http :as http])

(defn handler [req]
  {:status 200
   :headers {"content-type" "text/plain"}
   :body "hello!"})

(http/start-server handler {:port 8080})

2019-01-11T12:31:38.020100Z

I think the start-server returns that close fn

2019-01-11T12:32:30.020300Z

Oh actually not true

2019-01-11T12:32:43.020600Z

We stop it like this

:stop [server-instance (do (log/info "stopping Server on port" port)
                                (.close server-instance)
But older version maybe

kwladyka 2019-01-11T12:33:34.020900Z

(defn handler [req]
  {:status 200
   :headers {"content-type" "text/plain"}
   :body "hello!"})

(def foo (http/start-server handler {:port 8080}))

(.close foo)
Jan 11, 2019 1:33:05 PM io.netty.util.concurrent.DefaultPromise notifyListener0
WARNING: An exception was thrown by aleph.netty$wrap_future$reify__16507.operationComplete()
java.lang.NoClassDefFoundError: Could not initialize class manifold.deferred.Deferred$fn__3629
	at manifold.deferred.Deferred.success(deferred.clj:398)
	at manifold.deferred$success_BANG_.invokeStatic(deferred.clj:243)
	at manifold.deferred$success_BANG_.invoke(deferred.clj:240)
	at aleph.netty$wrap_future$reify__16507.operationComplete(netty.clj:199)
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
	at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:94)
	at io.netty.util.concurrent.MultithreadEventExecutorGroup$1.operationComplete(MultithreadEventExecutorGroup.java:117)
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
	at io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:33)
	at io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:435)
	at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:248)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)

kwladyka 2019-01-11T12:36:49.021100Z

https://github.com/ztellman/aleph/issues/365 it is probably this issue

kwladyka 2019-01-11T12:37:13.021700Z

But not sure why I have this issue and you not 🙂

kwladyka 2019-01-11T12:37:23.021900Z

Can you paste your versions?

kwladyka 2019-01-11T12:41:14.022100Z

Do you use Java 11?

kwladyka 2019-01-11T12:57:03.022400Z

@whoneedszzz Did you have this issue ? ^

2019-01-11T13:15:31.022900Z

@kwladyka No for the app it works we are using java 8

2019-01-11T13:15:56.023200Z

and an older clojure version 1.8

👍 1
kachayev 2019-01-11T13:21:01.025100Z

The root cause of the issue was described here: https://github.com/ztellman/aleph/pull/425 The fix is not merged yet, updates to manifold thread factories are (but that’s just a part of the puzzle)

👍 1
kwladyka 2019-01-11T13:21:36.025500Z

But the point is how can I live with it today? 😉

kwladyka 2019-01-11T13:21:44.025700Z

any workaround?

kwladyka 2019-01-11T13:23:56.026300Z

Just It will be great to be able to reload server when developing

kwladyka 2019-01-11T13:24:08.026600Z

Instead kill REPL / start REPL

kwladyka 2019-01-11T13:26:35.027Z

branch kachayev:ft-gracefull-shutdown has this bug fixed?

kachayev 2019-01-11T13:50:19.031400Z

Not sure about that, I moved the fix to a separate branch on purpose (to make it easier to merge to master). Need to check if it’s still included there. In fact, you can ignore those error messages :) That’s annoying, but it does no harm to the functionality itself: it just fails to deliver notification that the operation is already completed (which means that’s the server is closed)

kwladyka 2019-01-11T13:53:26.032200Z

hmm super strange thing happen. I made a break to eat dinner and now I don’t have this error

kwladyka 2019-01-11T13:54:56.033Z

thanks for info it doesn’t affect closing the server. I didn’t realise that.

kwladyka 2019-01-11T13:55:36.033300Z

now I have it again wow. I changed nothing

kwladyka 2019-01-11T14:01:55.033700Z

ha I found something! I will describe it in issue in +1h

WhoNeedszZz 2019-01-11T20:06:50.034400Z

@kwladyka There's nothing wrong with the method that the yada manual describes. I'm using it right now

kwladyka 2019-01-11T21:54:00.036900Z

@whoneedszzz i have this issue https://github.com/ztellman/aleph/pull/425 also when use yada directly as in the doc. But this issue appear only when you didn’t open website even once.