Skip to content

Thread leak or expected behavior with fibers ? #1181

@fatum

Description

@fatum

I use simple gem fastimage to fetch image metadata, gem uses Fibers

When i run loop in console and watch for jruby process through jmap i see what count org.jruby.RubyThread objects and other thread related objects increased by time

Sample loop

10_000.times { fastimage = FastImage.new(src); fastimage.size; fastimage.type }

jmap output

 86:          1173          93904  [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;
 102:           582          65184  org.jruby.runtime.ThreadContext
 104:           594          61776  java.lang.Thread
 109:          1780          56960  java.lang.ThreadLocal$ThreadLocalMap$Entry
 116:           583          51304  org.jruby.RubyThread
 138:           582          32592  org.jruby.ext.fiber.ThreadFiber
 144:           587          28176  java.util.concurrent.ThreadPoolExecutor$Worker
 145:          1173          28152  java.lang.ThreadLocal$ThreadLocalMap
 195:           583          13992  org.jruby.internal.runtime.NativeThread
 198:           581          13944  org.jruby.ext.fiber.ThreadFiber$1
 287:             2           4160  [Ljava.lang.Thread;
 639:            23            368  java.lang.ThreadLocal
 823:             7            224  org.jruby.ext.thread.Mutex
 825:             4            224  java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
 834:             3            216  java.util.concurrent.ThreadPoolExecutor
 959:             2            160  org.jruby.ext.thread.SizedQueue$INVOKER$i$1$0$push
1214:             3            144  java.lang.ThreadGroup
1236:             5            120  org.jruby.ext.fiber.ThreadFiberState

Environment:
MacOs,
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode),
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_17-b02 [darwin-x86_64]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions