someteam / acha

Git Achievements
http://acha-acha.co
Eclipse Public License 1.0
466 stars 33 forks source link

Error on import of repo break all application. #3

Closed aliaksei-lithium closed 9 years ago

aliaksei-lithium commented 9 years ago

Successful import some rather big projects from gitlab, but from one of them get the error below. With this bug i can`t even see others repos and achievements. After f5 only purple line and log message ->

Thu Oct 09 16:14:24 FET 2014 [worker-1] ERROR - GET /api/db/
java.lang.RuntimeException: java.lang.IllegalArgumentException: No matching ctor found for class java.util.Date
        at com.cognitect.transit.impl.WriterFactory$1.write(WriterFactory.java:120)
        at cognitect.transit$write.invoke(transit.clj:140)
        at acha.server$write_transit_bytes.invoke(server.clj:25)
        at acha.server$wrap_transit_response$fn__9136$fn__9137.invoke(server.clj:35)
        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 clojure.core$update_in.doInvoke(core.clj:5853)
        at clojure.lang.RestFn.invoke(RestFn.java:445)
        at acha.server$wrap_transit_response$fn__9136.invoke(server.clj:33)
        at ring.middleware.params$wrap_params$fn__7697.invoke(params.clj:64)
        at compojure.core$routing$fn__9057.invoke(core.clj:118)
        at clojure.core$some.invoke(core.clj:2560)
        at compojure.core$routing.doInvoke(core.clj:118)
        at clojure.lang.RestFn.invoke(RestFn.java:423)
        at acha.server$fn__9232.invoke(server.clj:91)
        at compojure.core$if_context$fn__9079.invoke(core.clj:189)
        at compojure.core$routing$fn__9057.invoke(core.clj:118)
        at clojure.core$some.invoke(core.clj:2560)
        at compojure.core$routing.doInvoke(core.clj:118)
        at clojure.lang.RestFn.applyTo(RestFn.java:139)
        at clojure.core$apply.invoke(core.clj:628)
        at compojure.core$routes$fn__9061.invoke(core.clj:123)
        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)
Caused by: java.lang.IllegalArgumentException: No matching ctor found for class java.util.Date
        at clojure.lang.Reflector.invokeConstructor(Reflector.java:183)
        at acha.db$ach__GT_entity.invoke(db.clj:170)
        at clojure.core$map$fn__4345.invoke(core.clj:2614)
        at clojure.lang.LazySeq.sval(LazySeq.java:40)
        at clojure.lang.LazySeq.seq(LazySeq.java:49)
        at clojure.lang.RT.seq(RT.java:484)
        at clojure.core$seq.invoke(core.clj:135)
        at clojure.core$concat$cat__4053$fn__4054.invoke(core.clj:696)
        at clojure.lang.LazySeq.sval(LazySeq.java:40)
        at clojure.lang.LazySeq.seq(LazySeq.java:49)
        at clojure.lang.Cons.next(Cons.java:39)
        at clojure.lang.LazySeq.count(LazySeq.java:65)
        at clojure.lang.LazySeq.size(LazySeq.java:167)
        at com.cognitect.transit.impl.Util.arraySize(Util.java:41)
        at com.cognitect.transit.impl.AbstractEmitter.emitArray(AbstractEmitter.java:134)
        at com.cognitect.transit.impl.AbstractEmitter.marshal(AbstractEmitter.java:221)
        at com.cognitect.transit.impl.AbstractEmitter.emitTagged(AbstractEmitter.java:91)
        at com.cognitect.transit.impl.AbstractEmitter.emitEncoded(AbstractEmitter.java:116)
        at com.cognitect.transit.impl.AbstractEmitter.marshal(AbstractEmitter.java:226)
        at com.cognitect.transit.impl.AbstractEmitter.marshalTop(AbstractEmitter.java:250)
        at com.cognitect.transit.impl.JsonEmitter.emit(JsonEmitter.java:29)
        at com.cognitect.transit.impl.WriterFactory$1.write(WriterFactory.java:117)
        ... 28 more
tonsky commented 9 years ago

Looks like an error during Date serialization. Some commit is without a Date? Can you possibly narrow down this error case? A header from Commit object would be enough.

We’ll add logs for that case in next version anyway

aliaksei-lithium commented 9 years ago

It is hard to find that commit or smth else, im looking in last added repos - no one commit without date(mb one of them but i can't find...) So, main goal - ignore such exception and do not break all staff, just warn log will be great.

avasenin commented 9 years ago

Could you run the following commands

cd acha
sqlite3 .acha/db.sqlite
select achievement.sha1, repo.url  from achievement left join repo on repo.id = achievement.repoid where achievement.timestamp is NULL or achievement.assigned is NULL;

If anything are returned then please provide commit infos for these specific commits

aliaksei-lithium commented 9 years ago

I get nothing . But im reimport some repos and find one that breaks all. But, i find one commit without commiter and author, mb it can cause a problem

  % sqlite3 db.sqlite                                                                                         
SQLite version 3.8.2 2013-12-06 14:53:30
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select achievement.sha1, repo.url  from achievement left join repo on repo.id = achievement.repoid where achievement.timestamp is NULL or achievement.assigned is NULL;
sqlite> 
avasenin commented 9 years ago

Could you provide any details regarding this issue? I'm going to close this ticket because we can't reproduce it on our side.

aliaksei-lithium commented 9 years ago

So, really i can't reproduce it to now. But I found broken commit in repo and fix it. After this and re-import repo - it seems work ok. I really do not know how to break commit in this way again.

13h3r commented 9 years ago

Got the same error. Given query return no records.

tonsky commented 9 years ago

Any chance we can look at the repo? Or at least output from select * from achievement? What version do you use?

13h3r commented 9 years ago

select * from achievements was empty. I use latest 0.2.3 version. How can I figure out which repo causing problem?

tonsky commented 9 years ago

@13h3r select * from achievement, not achievements, right? Maybe you could provide us with the whole database? We save SHA-1 only, we don’t even save commit messages, so in theory there’s nothing confidential and DB can be freely shared

13h3r commented 9 years ago

@tonsky sure, achievement. I tried to reproduce this problem, but acha works well. Next time I will provide sqlite file

13h3r commented 9 years ago

Few seconds after previous comment I have got this error again. Here it is the dump - https://www.dropbox.com/s/3mp48yta460ui22/issue3-db.sqlite.gz?dl=0

avasenin commented 9 years ago

Thanks for provided information @13h3r.

According to this dump the commit 732f46eacadf1ade5309034af9a406a50bbe168b in cedar.git has timestamp = 0. Sqlite interprets this value as Integer and Clojure doesn't find necessary constructor.

I've fixed this case but it's weird that commit has timestamp = 0. Could you check commit date on your side and confirm that it's a commit issue?

13h3r commented 9 years ago

Thanks @avasenin! I can confirm that 732f46eacadf1ade5309034af9a406a50bbe168b has no commit date. I have no idea why :)

tonsky commented 9 years ago

There’s now a stable release that fixes that: https://github.com/someteam/acha/releases/tag/0.2.4

13h3r commented 9 years ago

Thanks!