Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 20:34
    straight-shoota labeled #12544
  • 20:34
    straight-shoota labeled #12544
  • 20:34
    straight-shoota opened #12544
  • 20:34
    straight-shoota labeled #12544
  • 19:47
    straight-shoota synchronize #12541
  • 15:01
    straight-shoota opened #12543
  • 15:01
    straight-shoota labeled #12543
  • 15:01
    straight-shoota labeled #12543
  • 14:41
    zw963 opened #12542
  • 14:41
    straight-shoota milestoned #12282
  • 14:41
    straight-shoota milestoned #12282
  • 14:41
    straight-shoota unlabeled #12282
  • 13:44
    beta-ziliani milestoned #12536
  • 13:44
    beta-ziliani milestoned #12536
  • 13:32
    straight-shoota closed #12109
  • 13:06
    beta-ziliani milestoned #12494
  • 13:06
    beta-ziliani milestoned #12494
  • 13:05
    beta-ziliani milestoned #12539
  • 13:05
    beta-ziliani milestoned #12539
  • 11:36
    straight-shoota converted_to_draft #12541
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
I'm trying to send it but this client is weird
Alright, so. When you contact /1 first, the backend won't be able to accept any other request after
if you contact /2 first the backend will just work as expected
George Dietrich
@Blacksmoke16
are you making the requests via opening chrome tabs?
1 reply
each request is handled in its own fiber. The loop would block all requests to /1, but other requests would be fine
actually wait
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
Ok, I'll try waiting. This time with curl
George Dietrich
@Blacksmoke16
naw i think you're right. there's no IO or anything so it would never switch to another fiber
but would prob timeout after some period of time
however this ofc represents a bug in your code that could be handled via testing no?
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
Just to be sure I waited and no sign of life
Yeah, you could avoid this via automated testing, but this is still a really huge problem
George Dietrich
@Blacksmoke16
MT would also prevent this
until all threads were blocked at least
idk, hasn't come up really so might not be that big of an issue :shrug:
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
Imagine having discovering a new edgecase not covered by tests having your backend bombarded by it until all threads are blocked
Btw is the single client not allowing me to edit messages or is it a matrix thing?
George Dietrich
@Blacksmoke16
not sure, i just use gitter web
wonder if there is a place for ameba in this as well. Like warn on cases where an infinite loop could occur
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
Yes, it was a client problem, I'm on element now
Through testing a good analysis are a small patch on really big hole though
George Dietrich
@Blacksmoke16
can manually do sleep 0 to somewhat get around this tho
as it'll check if other fibers need to execute and switch to them, then eventually get back to that fiber
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
Yeah, but on Discord some time ago I showed you a case where this wasn't really possible
Here the problem came up because I wanted to concurrently handle input and output trough NCurses
George Dietrich
@Blacksmoke16
yea dunno, having it be based on partial C could prob doesn't make it easier either
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
This is a big problem that should absolutely not be ignored further in a language that calls itself production ready
Imo calling Crystal production ready with this single problem (which is not the only one) is really v-lang level talk
George Dietrich
@Blacksmoke16
:shrug: make a forum thread about this info and see if there's any quick wins
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
I forgot that Crystal had a forum. Yeah, I think that I'll start a thread
George Dietrich
@Blacksmoke16
some would argue the biggest problem is windows support, or MT not being 100% yet, etc. Doesn't mean it's not production ready
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
In fact I'm not saying that's it's the biggest problem. I'm saying that it's an incredibly huge problem, yet not the biggest one
George Dietrich
@Blacksmoke16
maybe less so in some areas, but in the end is just another problem that needs solving
ddd
@Dan-Do
I am dealing with that using timeout channel atm
Kirk Haines
@wyhaines
I don't think it's really even a problem that needs to be solved. The fact that fibers do not have a pre-emptive scheduler means that one must understand that fact when writing concurrent code, but it's hardly a flaw. Insert a Fiber.yield into the loop, and it is no longer blocking.
Quinton Miller
@HertzDevil
Screenshot_20210622_142745.png
Screenshot_20210622_143005.png
soon...?
the asm output is not very useful if i include the prelude
Quinton Miller
@HertzDevil
in fact compiling anything with the prelude and --release causes a timeout
Alex Kampa
@alex-kampa

can manually do sleep 0 to somewhat get around this tho

Hi @Blacksmoke16 will "sleep 0 "have the same effect as Fiber.yield ?

@wyhaines you suggested Fiber.yield, what do you think about "sleep 0", what's the difference?
From IRC (bridge bot)
@FromIRC
<straight-shoota> It's literally the same: Fiber.yield is implemented as sleep(0)
Alex Kampa
@alex-kampa

Ok, so just to be 100% sure, the place to insert this would be as follows:

spawn do
  loop do
    server.accept do |client|
      message = client.gets
      client << process(message)
    end
    Fiber.yield # same as sleep(0)
  end
end

Is that correct?

From IRC (bridge bot)
@FromIRC
<straight-shoota> Technically, yes. But it's really not necessary at this location.
<straight-shoota> Yielding a fiber is a tool you would use in a tight loop to give the scheduler an opportunity to change to some other task.
<straight-shoota> But your loop contains I/O operations which already expose such opportunities due to their async implementation
Alex Kampa
@alex-kampa
Thanks for the clarification. Yes I noticed that it all works well without putting in the Fiber.yield.