Skip to content
Commits on Mar 28, 2011
  1. Bump npm version -> 0.2.4

  2. Fix failure when multiple fibers finish together

    If multiple fibers finished one after in an unexpected way there would
    be a memory leak because `delete_me` would get overwritten. There was an
    assertion in place to prevent this scenario, and a case was discovered
    which triggers this condition. It was actually quite hard to hit because
    the coroutine pool masks this issue very well. The issue was fixed by
    deleting dead coroutines as soon as possible, instead of at the next
    call to run()
    Closes gh-16
Commits on Mar 25, 2011
  1. @lm1

    Added w/a for broken node 4.x

    lm1 committed with
  2. @lm1

    Node fixed streaming from stdin

    lm1 committed with
Commits on Mar 22, 2011
  1. Fix fibers in strict mode

    `yield` is a reserved future keyword in Javascript. Thus in strict mode,
    "yield()" will fail to parse. This adds an alias for yield() on the
    global Fiber object to give you a way to yield in strict mode. The
    global yield() is left for brevity and compatibility.
Commits on Mar 11, 2011
  1. Bump npm version

Commits on Mar 9, 2011
  1. Fix broken pipe errors

    Node isn't really good at pipes.
  2. (maybe) Fix build for optimizated pthreads

    glibc has a #define which defines an inline copy of pthread_equal. This
    is causing build errors, so look for the define and avoid the
    redefinition in this case.
    Closes gh-13
  3. Fix `started` property

    37d9003 broke the `started` property
    because arguments.Holder() is apparently the wrong function to use for
    Closes gh-12
Commits on Mar 3, 2011
  1. Use v8 Signature for instance verification

    I was using some SetHiddenProperty hack to prevent segfaults when you do
    something like:
    I figured v8 had something like this built in but didn't discover it
    until now.
Commits on Feb 24, 2011
  1. Improve discovery of coroutine shim

    The fiber-shim script couldn't find on npm installations
    with unexcepted configurations. This makes the script use
    require.resolve() internally which should improve compatibility.
    Closes gh-9
  2. Fix `process.title` on OS X

    Setting `process.title` caused a segfault on OS X, due to some weird
    craziness that happens in that function. Some OS X libraries call
    pthread_self from threads has no idea about, and then the
    fun stops.
    Closes gh-10
Commits on Feb 23, 2011
  1. Remove rogue GC debugging

    I left some GC debugging code in here which impacted performance.
Commits on Feb 22, 2011
  1. Bump npm version to 0.2.0

    Also includes some readme changes
  2. Store Fiber.current in a property

    By getting rid of the Fiber.current getter and just resetting it every
    time it changes we can drastically speed up access to that property,
    since it saves a trip out of the v8 engine. In most cases it seems like
    people will be using Fiber.current, so this is a good change to make.
  3. Misc refactor

    This started off as a diff to keep a Locker active for each coroutine
    even while not in use by v8, which would save the once-per-thread cost.
    Turns out that cost isn't very high, and clearing out the threads is
    better for garbage collection anyway. But the code cleaning up here was
    pretty good so I'm putting this in.
  4. Fix initialization on linux

    There's no automatic calls to pthread_key_create in linux, so
    Loader::bootstrap() wasn't getting called before static library
Commits on Feb 20, 2011
  1. Refactor initialization logic

    This simplifies initialization into a clear 2-phase dichotomy. The first
    phase runs before malloc is ready, and the second phase is in regular
    initialization. This incidentally plugs a hole where thread-specific
    keys were getting lost early in initialization. I think there's still a
    condition where you could lose data, but OS X and Linux aren't hitting
    it so it's ok for now.
  2. Remove Snapshot special casing

    I didn't actually need this. I only noticed this behavior in isolated v8
    tests while researching. But once node has already initialized the
    first context the snapshot isn't used anymore after that.
  3. Workaround v8 bugs with small stacks

    v8 seems to have some issues when you try and use stack sizes smaller
    than it's used to.
    First is that if you attempt to set a stack limit that's smaller than
    the snapshot size (if enabled) it will crash your shit in a very hard to
    understand way. Unfortunately there's no way to actually know what that
    magic size is in advance, so I'm just using a secret v8 internal
    variable. This means that for most systems each coroutine will consume
    ~320kb of memory.
    Second issue is there's a bug on 64 bit platforms when your Javascript
    overflows the stack. It's probably pretty hard to hit this bug in
    regular code but it's still quite bad. There's a workaround that I'm
    using to get past that.
Commits on Feb 18, 2011
  1. Fix that pesky stack bug

    I was giving v8 the top of the stack instead of the bottom of the stack
    so it couldn't figure out where to stop. This change fixes that. I
    tested this using an infinite recussion function with really small
    stacks (8kb) and large ones (512k) and I'm getting reasonable results.
    Now the hard part is picking the right stack size. I'm going to go with
    64k as it's the default stack node picked for libeio threads.
  2. Bump npm version

  3. Simplify fiber-local storage

    Put FLS in the Coroutine object instead of with the thread in a vector.
    This technically means we are no longer calling destructors on
    outstanding keys when the keys are deleted, but that was already the
    case with multiple threads. The up side is that no one really deletes
    TLS keys unless the program is terminating anyway.
  4. Make context swap ownership more explicit

    When swapping into a context we shouldn't remember the context we came
    from at all. That is the client's ( job. By setting the
    current_fiber this way we can be sure current_fiber is never something
  5. Fix terrible bug in thread trampoline

    New threads created while the coroutine library is loaded have a pretty
    good chance of getting corrupted it seems. eio threading hasn't been
    put through too much scrutiny unfortunately, so I didn't catch this
    until now.
  6. Spaces -> Tabs

    I'm going through my biennial spaces and tabs identity crisis. Tabs,
    you've hurt me in the past.. I just hope that I've learned enough so
    that it won't happen again. I'm putting a lot of faith in you, please
    don't leave me cold and alone.
Commits on Feb 17, 2011
  1. Bump npm version

  2. Volatile members

    This declares the member variables which getting mucked with from
    different fibers as volatile. Hopefully this will take care of some of
    the heisenbugs a few users have been reporting.
  3. Hook pthreads earlier

    It seems that if you have v8 compiled as a shared library instead of a
    static library sometimes it can get initialized before, even
    with LD_PRELOAD. I'm not really sure why this is the case, but this
    means we need to run the hooks much earlier. So now everything that goes
    through pthread_getspecific is fiber-local, instead of the way it used
    to be where only keys created after is initialized were
  4. Improved check for invalid calls to run()

    If you attempt to run() a fiber that's already running from inside
    another fiber you would get a segfault. This is because even though the
    fiber isn't running, it hasn't yielded either. Thus where to resume
    execution is unclear. This should throw an exception.
    Closes gh-8
Commits on Feb 5, 2011
  1. Another bug with the loader script

  2. Fix syntax error in fibers.js

    Whoops, how did this get in there? I swear I tested..
Commits on Feb 3, 2011
  1. Fix node v0.2.x compatibility

    require.resolve is a new feature. v0.3.x is going stable soon, after
    which support for v0.2.x will dwindle. This also fixes 32-bit building
    on some platforms.
    Closes gh-7
Commits on Jan 25, 2011
  1. Remove boost dependency

    Sometimes I forget that non-developers don't have boost installed... so
    to lower the friction of installation for the first time I'm removing
    boost since it's used in one place only anyway.
Commits on Jan 24, 2011
  1. Package tweaks

    Detect on load when the fibers library is older than node, which
    probably means your build is out date. Also fix it so that `npm rebuild
    fibers` works.
Something went wrong with that request. Please try again.