Skip to content

Instantly share code, notes, and snippets.

View pk11's full-sized avatar

Peter Hausel pk11

  • Silicon Valley, CA
View GitHub Profile
@pk11
pk11 / gist:3975910
Created October 29, 2012 19:23
oops
at scala.sys.package$.error(package.scala:27)
at scala.Predef$.error(Predef.scala:123)
at sbt.Tests$.showResults(Tests.scala:192)
at sbt.Defaults$$anonfun$testTasks$6.apply(Defaults.scala:296)
at sbt.Defaults$$anonfun$testTasks$6.apply(Defaults.scala:294)
at sbt.Scoped$$anonfun$hf4$1.apply(Structure.scala:580)
at sbt.Scoped$$anonfun$hf4$1.apply(Structure.scala:580)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
Good news, I've found the problem, a simple race condition.
The issue was in Promise.scala, the test was finishing before the thread
that had initialised the promise subsystem had had a chance to set the
underlyingSystem Option, so when the test
shutdown code went to shut down the promise system, it found no system to shutdown.
Synchronizing all access to that global var solved the problem.
@pk11
pk11 / gist:3707286
Created September 12, 2012 15:14
scala 2.10.0-M7 compiler crash
source file:
-----------
https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/api/libs/json/Util.scala
trace:
------
[ERROR] error: java.lang.reflect.InvocationTargetException
[INFO] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[INFO] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[INFO] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[INFO] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[INFO] at scala.tools.nsc.plugins.Plugin$.instantiate(Plugin.scala:150)
[INFO] at scala.tools.nsc.plugins.Plugins$$anonfun$loadRoughPluginsList$1.apply(Plugins.scala:34)
[INFO] at scala.tools.nsc.plugins.Plugins$$anonfun$loadRoughPluginsList$1.apply(Plugins.scala:34)
[INFO] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
[INFO] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
@pk11
pk11 / gist:3488129
Created August 27, 2012 12:49
playbench 2.10.0-M7 java7
[error]
[error] while compiling: /Users/phausel/workspace/playbench/src/main/scala/play/api/libs/concurrent/Promise.scala
[error] during phase: typer
[error] library version: version 2.10.0-M7
[error] compiler version: version 2.10.0-M7
[error] reconstructed args: -classpath /Users/phausel/workspace/playbench/target/scala-2.10/classes:/Users/phausel/.ivy2/cache/com.google.guava/guava/jars/guava-10.0.1.jar:/Users/phausel/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.1.jar:/Users/phausel/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-1.2.jar:/Users/phausel/.ivy2/cache/org.javassist/javassist/jars/javassist-3.16.1-GA.jar:/Users/phausel/.ivy2/cache/org.apache.commons/commons-lang3/jars/commons-lang3-3.1.jar:/Users/phausel/.ivy2/cache/org.apache.ws.commons/ws-commons-util/jars/ws-commons-util-1.0.1.jar:/Users/phausel/.ivy2/cache/junit/junit/jars/junit-3.8.1.jar:/Users/phausel/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.0.b2.jar:/Users/phausel/.ivy2/cache/io.netty/netty/bundles/ne
@pk11
pk11 / gist:3288020
Created August 7, 2012 18:19
print current threads
public static void printThreads() {
// Find the root thread group
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
while (root.getParent() != null) {
root = root.getParent();
}
// Visit each thread group
visit(root, 0);
}
@pk11
pk11 / gist:3043883
Created July 3, 2012 22:38
using WHITESPACE only compilation level and pretty printing for an alternative closure CompilerOptions
//in Build.scala
//requires play 2.1!
import com.google.javascript.jscomp._
val defaultOptions = new CompilerOptions()
defaultOptions.closurePass = true
CompilationLevel.WHITESPACE_ONLY.setOptionsForCompilationLevel(defaultOptions)
defaultOptions.setProcessCommonJSModules(true)
val root = new java.io.File(".")
defaultOptions.setCommonJSModulePathPrefix(root.getCanonicalPath+"/app/assets/javascript/")
@pk11
pk11 / offline
Created June 22, 2012 21:33
offline
echo "[setup global]"
echo "credentials += Credentials(Path.userHome / \".ivy2\" / \".credentials\")" > ~/.sbt/global.sbt
echo "" >> ~/.sbt/global.sbt
echo "offline := true" >> ~/.sbt/global.sbt
rm -rf $PLAY_HOME/repository/local/play*
rm -rf $PLAY_HOME/repository/cache/play*
rm -rf $PLAY_HOME/repository/cache/scala_2.9.*/sbt_0.*.*/play
echo "[republish play]"
@pk11
pk11 / gist:1472884
Created December 13, 2011 16:49
recent performance related improvements in scala
https://github.com/scala/scala/commit/4cfc633fc6cb2ab0f473c2e5141724017d444dc6
https://github.com/scala/scala/commit/c352105fa082f88163869c0ba86f3e32aff57fc7
https://github.com/scala/scala/commit/5fb26c6a889cf1609823338df8783bf880769b3f
https://github.com/scala/scala/commit/1b98d1fa2a54dc1d8fafed6d270534d729420c21
https://github.com/scala/scala/commit/989c0d0693e27d06d1f70524b66527d1ef12f5a2
https://lampsvn.epfl.ch/trac/scala/changeset/26042
https://github.com/scala/scala/pull/16
@pk11
pk11 / gist:1011600
Created June 7, 2011 02:47
gitignore
target/
project/boot/*
project/target
project/plugins/target
project/plugins/project/*
.idea/*