Skip to content

Instantly share code, notes, and snippets.

View jeffstyr's full-sized avatar

Jeff Clites jeffstyr

View GitHub Profile
@jeffstyr
jeffstyr / TestLockTimeoutViaUnfairScheduling.java
Created October 10, 2012 00:48
tryLock() can timeout due to non-fair locking/scheduling effects
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
/**
* javac TestLockTimeoutViaUnfairScheduling.java; java -cp . TestLockTimeoutViaUnfairScheduling
*/
public class TestLockTimeoutViaUnfairScheduling {
@jeffstyr
jeffstyr / ForgottenLockTest.java
Created July 26, 2012 07:55
Held locks do not all show up in stacktraces
import java.util.*;
import java.util.concurrent.locks.*;
/*
javac ForgottenLockTest.java
java -cp . ForgottenLockTest
^\
*/
public class ForgottenLockTest {
@jeffstyr
jeffstyr / patch-path.c.diff
Created July 3, 2012 23:16 — forked from kontrafiktion/patch-path.c.diff
homebrew subversion unicode-path patch for svn 1.7.5
--- subversion/libsvn_subr/path.c.orig 2011-01-17 13:45:39.000000000 -0800
+++ subversion/libsvn_subr/path.c 2012-07-03 16:19:11.000000000 -0700
@@ -40,6 +40,9 @@
#include "dirent_uri.h"
+#if defined(DARWIN)
+#include <CoreFoundation/CoreFoundation.h>
+#endif /* DARWIN */
@jeffstyr
jeffstyr / Makefile.in.diff
Created June 28, 2012 01:13
homebrew subversion perl bindings patch svn 1.7.5
--- Makefile.in.orig 2011-07-16 04:50:53.000000000 -0700
+++ Makefile.in 2012-06-27 21:21:27.000000000 -0700
@@ -736,7 +736,7 @@
./config.status subversion/bindings/swig/perl/native/Makefile.PL
$(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/native/Makefile.PL
- cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL
+ cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL PREFIX=$(prefix) INSTALLARCHLIB=$(swig_pldir)
# There is a "readlink -f" command on some systems for the same purpose,
@jeffstyr
jeffstyr / gist:1212071
Created September 12, 2011 18:59
QueueCollection + PersistentQueue deadlock
Found one Java-level deadlock:
=============================
"New I/O server worker #1-48":
waiting to lock monitor 0x0000000059f639b0 (object 0x000000072bba4d90, a net.lag.kestrel.QueueCollection),
which is held by "Hashed wheel timer #1"
"Hashed wheel timer #1":
waiting to lock monitor 0x000000005a9c4378 (object 0x000000072bb8c7a0, a net.lag.kestrel.PersistentQueue),
which is held by "New I/O server worker #1-41"
"New I/O server worker #1-41":
waiting to lock monitor 0x0000000059f639b0 (object 0x000000072bba4d90, a net.lag.kestrel.QueueCollection),
@jeffstyr
jeffstyr / TestVoldemortStoreClient.java
Created September 12, 2011 06:31
Null reads under multithreaded usage of Voldemort's StoreClient
import voldemort.client.ClientConfig;
import voldemort.client.SocketStoreClientFactory;
import voldemort.client.StoreClient;
import voldemort.client.StoreClientFactory;
import voldemort.client.UpdateAction;
import voldemort.versioning.Versioned;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;