Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:53
    caspiano edited #12557
  • 07:52
    caspiano opened #12557
  • 07:24
    caspiano synchronize #12556
  • 07:11
    caspiano synchronize #12556
  • 07:10
    caspiano opened #12556
  • 00:24
    straight-shoota milestoned #12555
  • 00:24
    straight-shoota milestoned #12555
  • Oct 03 21:13
    beta-ziliani closed #12555
  • Oct 03 20:50
    straight-shoota closed #12554
  • Oct 03 20:49
    straight-shoota edited #12554
  • Oct 03 18:13
    straight-shoota labeled #12555
  • Oct 03 18:13
    straight-shoota opened #12555
  • Oct 03 17:42
    straight-shoota milestoned #12551
  • Oct 03 17:42
    straight-shoota milestoned #12551
  • Oct 03 15:55
    straight-shoota labeled #12554
  • Oct 03 15:55
    straight-shoota labeled #12554
  • Oct 03 15:55
    straight-shoota edited #12554
  • Oct 03 15:55
    straight-shoota edited #12554
  • Oct 03 15:54
    straight-shoota opened #12554
  • Oct 03 14:44
    straight-shoota milestoned #9326
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.
Rishav Sharan
@rishavs
Hey @straight-shoota how goes the Windows signals work? eagerly awaiting it. :smiley_cat:
From IRC (bridge bot)
@FromIRC
<yxhuvud> straight-shoota: I wouldn't mind moving Scheduler#yield to a event loop dependent place though. I don't know about how it would work on windows but at least for uring it makes no sense to set up a timer instead of using a NOP op.
<yxhuvud> assuming there is even need to emit an op in the first place, which is questionable.
<straight-shoota> @rishavs, Windows is not exactly made for signals. We'll probably be able to imitate a few of them, but you shouldn't expect that to work as on posix systems
<straight-shoota> More info on crystal-lang/crystal#7339
<straight-shoota> yxhuvud, yeah, that's probably a good idea. Fiber.yield == sleep 0 is an implementation detail of the event loop
Rishav Sharan
@rishavs
:heart:

I just want crystal on windows so I can do some gamejams using crsfml ^_^. I am not interested in the networking bits, just hate the effort it requires to set up crystal on windows currently.
I would be happy if I can just do scoop install crystal and the compiler after installation throws a big honking text Networking is currently not supported on windows platform.

Anyway, wanted to thank you and the rest of the team on picking more big rocks on the windows side of things.