Skip to content

Instantly share code, notes, and snippets.

View frsyuki's full-sized avatar

Sadayuki Furuhashi frsyuki

View GitHub Profile
public class X {
public static void main(String[] args) {
System.out.println("doit: "+doit());
}
public static int doit() {
try {
System.out.println("try");
throw new RuntimeException("exception");
@frsyuki
frsyuki / postgresql.log.1
Last active August 29, 2015 14:07
PostgreSQL DROP TABLE before checkpointing
LOG: statement: create table dt (data text);
LOG: statement: insert into dt (data) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
LOG: statement: insert into dt select * from dt;
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
require 'msgpack'
class PageSchema
def initialize(*keys)
@struct = Struct.new(*keys)
@struct.class_eval do
def to_msgpack(arg=nil)
packer = (arg.is_a?(MessagePack::Packer) ? arg : MessagePack::Packer.new(arg))
packer.write_array_header(self.size)
self.each_pair {|k,v| packer.write(k).write(v) }
require 'benchmark'
LOOP = 500000
NKEYS = 20
vals = (0..NKEYS).map {|i| "val#{i}" }
keys = (0..NKEYS).map {|i| "col#{i}" }
S = Struct.new(*keys.map {|k| k.to_sym })
Reading data from a socket hangs for at least 1 hour even if I set Socket.setSoTimeout to non-0 value. It happens very rarely (once a month under 100 or more connections in parallel with continuously 10MB/s or more data transfer).
Although it rarely happens, it leads significant impact to applications if it happens.
When it hanged, thread dump includes following stack trace:
----
"pool-3-thread-6" prio=10 tid=0x00007fd43006e800 nid=0xdf23 runnable [0x00007fd424e56000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
"main" prio=10 tid=0x00007f0fd800e800 nid=0x934a runnable [0x00007f0fdec8f000]
java.lang.Thread.State: RUNNABLE
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3067)
- locked <0x000000009e5c7f70> (a java.lang.Class for org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge)
at java.lang.Class.getAnnotation(Class.java:3029)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.isStateful(FunctionRegistry.java:1186)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.isDeterministic(FunctionRegistry.java:1161)
at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator.isDeterministic(ExprNodeGenericFuncEvaluator.java:143)
at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator.evaluate(ExprNodeGenericFuncEvaluator.java:153)
at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator$DeferredExprObject.get(ExprNodeGenericFuncEvaluator.java:64)
Add workaround for a deadlock issue of Class.getAnnotation() (JDK-7122142)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index a80feb9..c92b4f6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -1613,16 +1613,20 @@ public static boolean isDeterministic(GenericUDF genericUDF) {
// the deterministic annotation declares
return false;
}
all: run
MSGPACK_06_JAR = msgpack-java-0.6.11.jar
$(MSGPACK_06_JAR):
curl "http://search.maven.org/remotecontent?filepath=org/msgpack/msgpack/0.6.11/msgpack-0.6.11.jar" -o $@
JAVASSIST_JAR = javassist-3.18.2-GA.jar
$(JAVASSIST_JAR):
curl "http://search.maven.org/remotecontent?filepath=org/javassist/javassist/3.18.2-GA/javassist-3.18.2-GA.jar" -o $@