Questions tagged [fibers]

A fiber is a lightweight thread which uses cooperative rather than preemptive multitasking. It is very similar to and often confused with a [coroutine]. Use this tag for questions relating to the [ruby] feature, otherwise prefer to use [coroutine].

A fiber is a lightweight thread which uses cooperative rather than preemptive multitasking. It is very similar to and often confused with a .

In Ruby, fibers are primitives for implementing light weight cooperative concurrency. It appeared in Ruby 1.9.

Related tags

189 questions
3
votes
0 answers

How to set Node.js fibers blocking

I'm trying to create a more synchronized db module using node-mongodb-native. Currently stuck on fiberizing a db.open Any suggestions? thanks.
rizpng
  • 51
  • 1
  • 1
  • 5
2
votes
2 answers

Infinite Ruby Fibers?

Is it possible to create 2 Ruby's Fibers that call each other forever? Would Ruby eventually crash with the stack overflow or do the Fibers not consume stack space?
Eli Schneider
  • 4,903
  • 3
  • 28
  • 50
2
votes
1 answer

Why do Ruby fibers that run sequentially without a scheduler set run concurrently when a scheduler is set?

I have the following Gemfile: source "https://rubygems.org" ruby "3.1.2" gem "libev_scheduler", "~> 0.2" and the following Ruby code in a file called main.rb: require 'libev_scheduler' set_sched = ARGV[0] == "--set-sched" if set_sched then …
Matt Welke
  • 1,441
  • 1
  • 15
  • 40
2
votes
1 answer

Krakend http: invalid Read on closed Body

I'm using Krakend to build an API gateway to connect three backend services. The gateway always returns from one or two of the backend services with the X-Krakend-Completed header always set to false. What could be the cause of the http: invalid…
edwin walela
  • 48
  • 1
  • 5
2
votes
0 answers

What are the requirements for a valid call stack in x86_64?

Recently, I have stumbled upon an article explaining how to implement fibers in C (https://graphitemaster.github.io/fibers/). The article was eye-opening, as it showed that any contiguous memory region can be used as a call stack in place of the…
super
  • 278
  • 1
  • 11
2
votes
3 answers

Is `Thread.sleep` different with virtual threads (fibers) in Project Loom for Java

I use Thread.sleep when experimenting or demonstrating Java code for concurrency. By sleeping, I am faking some processing work taking place that will take some time. I wonder about doing this under Project Loom. Under Project Loom technology with…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
2
votes
1 answer

How to install fibers package on Azure Web App

I cannot install an application using Vuetify on Azure Web App with a dependency on fibers package. This package fails all the time, even when trying to install it alone (npm install fibers). I run a simple Windows machine with a Node LTS stack.…
Julen
  • 1,574
  • 3
  • 22
  • 38
2
votes
2 answers

Meteor Application Fails to Find Fibers Binary; Yet NPM Built a Different One

I am deploying my Meteor bundle to a similar Ubuntu 18.04 system as development. After running meteor (starting the application), I get the following error: ## There is an issue with `node-fibers`…
2
votes
1 answer

Call functions that require the main thread from different fibers

There are lots of functions that are supposed to be called from the main thread. In my limited experience, these are mostly UI functions. Examples: -[UIApplication delegate] must be called from main thread only) java.lang.IllegalStateException:…
sudo rm -rf slash
  • 1,156
  • 2
  • 16
  • 27
2
votes
0 answers

`UncaughtThrowError` raised when `throw` is called in a Fiber

I ran into an UnknownThrowError when a throw is called in the context of a Fiber. I am running Ruby 2.4.1. The problem can be reproduced with the sample code as follows: catch(:tag) do Fiber.new do throw(:tag) end.resume end Is this…
darkgrin
  • 570
  • 3
  • 8
2
votes
1 answer

cannot compile boost::fiber official examples

I am trying out boost::fiber library, but I couldn't manage to compile code with boost fiber. Therefore I turned into compiling and running boost official examples. I installed latest version of boost library 1.65.1, and installation seems to be…
Mass
  • 123
  • 11
2
votes
1 answer

State machine in Ruby using Fibers?

I'm trying to get a handle on the new Fiber class in Ruby 1.9 and I read that one of the more common applications for Fibers (and coroutines) is in state machines. Unfortunately my Fiber-fu isn't up to much, so I was hoping one of you could show me…
horseyguy
  • 29,455
  • 20
  • 103
  • 145
2
votes
0 answers

FiberError: 'fiber called across threads' using em-synchrony

I am using em-synchrony and em-http-request (Ruby 2.1) inside a sidekiq worker to scrape a number of links concurrently. Everything works well, except when I try and run multiple workers with the scraper at the same time. This is the code I'm…
TenJack
  • 1,594
  • 4
  • 21
  • 35
2
votes
1 answer

Modifying the stack on Windows, TIB and exceptions

The origin of my question effectively stems from wanting to provide an implementation of pthreads on Windows which supports user provide stacks. Specifically, pthread_attr_setstack should do something meaningful. My actual requirements are a bit…
Andrew Parker
  • 1,425
  • 2
  • 20
  • 28
2
votes
2 answers

Meteor 0.9.1.1 - Populating from json endpoint to Server side collections

I am writing a package as part of a small application I am working on and one thing I need to do is fetch json data from an endpoint and populate it to a Server side collection. I have been receiving error messages telling me I need to put by…
matfin
  • 499
  • 4
  • 15