ninjudd / cake

A tasty build tool for Clojure.
clojure-cake.org
Eclipse Public License 1.0
171 stars 12 forks source link

Can't consistently start cake or run tasks #120

Closed davidsantiago closed 12 years ago

davidsantiago commented 13 years ago

I was talking with @Raynes the other day about this on IRC and thought everyone had it. I did a bit of digging into the matter today, with my limited understanding of Ruby and how unix things work.

Here's the problem: I sometimes can't run cake commands. It is as if cake loses track of itself or its persistent process. The command runs, it complains that it is taking a long time to connect to the JVM, and then it just drops me back at the prompt with no further output. This happens repeatedly. Usually, eventually, at some point later, I will be able to make it work. It is the most frustrating part of using cake for me, and I decided to try to dig into why it's happening.

One thing is that I am trying to use Cake with Swank for web development on a virtual machine in Virtualbox. To do this, I load my home directory as a shared folder in the VB instance and then run cake swank on the VB instance, and then connect to that from emacs.

After looking through bin/cake a bit and trying to understand what I could, I suspect this might be a problem with the way cake currently works. It looks to me as if cake stashes the pid of its long-running process into .cake/{username}.pid. It could be there is some problem with the two different cake instances overwriting each other's pid files. I'm not sure that this is the case, however, because my username is different on the two machines, and because it appears to delete the pid file of the other one when I try to run it.

This whole problem happened to me again today, so I attached the session transcript to the end of this issue. I really can't understand it, because this behavior isn't clearly in the Ruby code, to the extent that I can understand that. I would expect, from what I saw, that there would be david.pid and David.pid in .cake/, and they would both coexist peacefully, since they would be looking for pids in different files. But you can see at the end, after nothing happens on my attempted "cake check," it has deleted david.pid. You can also clearly see that there is a cake process running this whole time, but it does not appear to be recorded anywhere or ever heard from again.

session transcript

David-Santiagos-Computer:servlet David$ ls .cake/ bake.pid cake.pid david.pid project.log
cake.log config history run/
David-Santiagos-Computer:servlet David$ cat .cake/david.pid 5956 59540 0.6.2-20110221.082826-97-g50e3827 David-Santiagos-Computer:servlet David$ ls -las .cake total 670184 0 drwxr-xr-x 10 David David 340 Jun 30 01:48 . 0 drwxr-xr-x 16 David David 544 Jun 28 23:56 .. 8 -rw-r--r-- 1 David David 17 Dec 16 2010 bake.pid 666448 -rw-r--r-- 1 David David 341218604 Jul 1 01:41 cake.log 8 -rw-r--r-- 1 David David 45 Jan 2 01:06 cake.pid 8 -rw-r--r-- 1 David David 178 Jun 2 00:39 config 8 -rw-r--r-- 1 David David 45 Jun 30 01:48 david.pid 24 -rw-r--r-- 1 David David 10024 Jun 6 23:55 history 3680 -rw-r--r-- 1 David David 1880093 Dec 16 2010 project.log 0 drwxr-xr-x 8 David David 272 Jun 30 10:52 run David-Santiagos-Computer:servlet David$ echo $USER David David-Santiagos-Computer:servlet David$ cake ps 52316 main -Xms128M -Xmx256M -XX:MaxPermSize=128M -Dpallet.admin.username=david -Dcake.project=/Users/David/Documents/Development/BattleTheory/servlet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/dev -Djava.library.path=lib/ext/native:lib/native:lib/dev/native 36989 main -Xms128M -Xmx256M -XX:MaxPermSize=128M -Dcake.project=/Users/David/Documents/Development/Clojure/stencil -Dbake.path=/Users/David/Documents/Development/Clojure/cake/dev -Djava.library.path=lib/ext/native:lib/native:lib/dev/native David-Santiagos-Computer:servlet David$ cake check [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart David-Santiagos-Computer:servlet David$ cake ps 52316 main -Xms128M -Xmx256M -XX:MaxPermSize=128M -Dpallet.admin.username=david -Dcake.project=/Users/David/Documents/Development/BattleTheory/servlet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/dev -Djava.library.path=lib/ext/native:lib/native:lib/dev/native 36989 main -Xms128M -Xmx256M -XX:MaxPermSize=128M -Dcake.project=/Users/David/Documents/Development/Clojure/stencil -Dbake.path=/Users/David/Documents/Development/Clojure/cake/dev -Djava.library.path=lib/ext/native:lib/native:lib/dev/native David-Santiagos-Computer:servlet David$ ls .cake bake.pid cake.pid history run cake.log config project.log

davidsantiago commented 13 years ago

Oh, also worth mentioning, is that this whole time, the cake swank process was running on my VB instance with pid 5956, as the file david.pid suggested. After the commands on my host machine, "cake check" would also fail on the VB instance.

Here's a session transcript from the VB instance, with some commands predating the commands in the above session transcript.

david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake swank 10.0.1.47:4005 @dev [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake swank 10.0.1.47:4005 @dev [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake ps 13431 main -Xmx512M -XX:MaxPermSize=256M -Dcake.project=/Users/David/Documents/Development/Clojure/cake-pallet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/bake -Djava.library.path=lib/ext/native:lib/native:lib/dev/native david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake swank 10.0.1.47:4005 @dev [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake ps 13431 main -Xmx512M -XX:MaxPermSize=256M -Dcake.project=/Users/David/Documents/Development/Clojure/cake-pallet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/bake -Djava.library.path=lib/ext/native:lib/native:lib/dev/native david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake ps13431 main -Xmx512M -XX:MaxPermSize=256M -Dcake.project=/Users/David/Documents/Development/Clojure/cake-pallet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/bake -Djava.library.path=lib/ext/native:lib/native:lib/dev/native david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake ps 13431 main -Xmx512M -XX:MaxPermSize=256M -Dcake.project=/Users/David/Documents/Development/Clojure/cake-pallet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/bake -Djava.library.path=lib/ext/native:lib/native:lib/dev/native david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake swank 10.0.1.47:4005 @dev [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake swank 10.0.1.47:4005 @dev started swank-clojure server on port 4005 david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake ps 5956 main -Xmx512M -XX:MaxPermSize=256M -Dpallet.admin.username=david -Dcake.project=/Users/David/Documents/Development/BattleTheory/servlet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/dev -Djava.library.path=lib/ext/native:lib/native:lib/dev/native 13431 main -Xmx512M -XX:MaxPermSize=256M -Dcake.project=/Users/David/Documents/Development/Clojure/cake-pallet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/bake -Djava.library.path=lib/ext/native:lib/native:lib/dev/native

[ AT THIS POINT, COMMANDS IN OTHER TRANSCRIPT ARE ALL RUN ]

david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake check [cake] connection to jvm is taking a long time... [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart david@ubuntu:/Users/David/Documents/Development/BattleTheory/servlet$ cake ps 5956 main -Xmx512M -XX:MaxPermSize=256M -Dpallet.admin.username=david -Dcake.project=/Users/David/Documents/Development/BattleTheory/servlet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/dev -Djava.library.path=lib/ext/native:lib/native:lib/dev/native 13431 main -Xmx512M -XX:MaxPermSize=256M -Dcake.project=/Users/David/Documents/Development/Clojure/cake-pallet -Dbake.path=/Users/David/Documents/Development/Clojure/cake/bake -Djava.library.path=lib/ext/native:lib/native:lib/dev/native

ninjudd commented 12 years ago

Closing since we're moving to lein