Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 16 19:05
    lbguilherme synchronize #11947
  • May 16 17:29
    straight-shoota milestoned #11971
  • May 16 17:15
    straight-shoota closed #12038
  • May 16 17:15
    straight-shoota closed #12036
  • May 16 17:14
    straight-shoota edited #12038
  • May 16 13:47
    straight-shoota closed #12051
  • May 16 13:47
    straight-shoota closed #12050
  • May 16 12:17
    beta-ziliani edited #7318
  • May 15 08:43
    r00ster91 closed #7318
  • May 15 08:17
    r00ster91 closed #7690
  • May 14 17:01
    Blacksmoke16 labeled #11995
  • May 14 13:03
    webhive closed #12055
  • May 14 10:19
    straight-shoota milestoned #12051
  • May 14 10:00
    I3oris edited #12051
  • May 14 08:45
    oprypin review_requested #11977
  • May 13 23:29
    Blacksmoke16 unlabeled #12061
  • May 13 22:56
    Blacksmoke16 edited #12061
  • May 13 22:56
    Blacksmoke16 edited #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
Quinton Miller
@HertzDevil
because on compiler explorer there should most certainly be only one non-library source file, everything else would be considered "third-party" code
aaaScript
@aaaScript
Hi everyone. I have a quick question. Has anyone ever had an issue with closing a HTTP::Server's port when it is created in a fiber. I'll try to see if I can come up with some cleaned code but I'm basically creating an having a new HTTP Server listen while in a spawn block so that it doesn't block the rest of the program. Then later I'm trying to close it with the #close function outside of the spawn block later on. However despite that it still leaves the socket open and listening. I'm assuming it needs to be closed within the spawn block but I'm wondering if anyone has some insight on that.
From IRC (bridge bot)
@FromIRC
<straight-shoota> that should really make no difference
From IRC (bridge bot)
@FromIRC
<yxhuvud> just make certain the fiber is actually done with it before closing it in the original fiber
aaaScript
@aaaScript
Is there a good way to ensure that a a fiber is complete and able to be closed? Since the http server is stuck on listening, I'm not sure of a way to send a close command while it's in that state.
From IRC (bridge bot)
@FromIRC
<straight-shoota> HTTP::Server#close should do
aaaScript
@aaaScript
Oddly enough using that method doesn't seem to do anything. I'll try to see if I can replicate it in a small block of code for some more context.
From IRC (bridge bot)
@FromIRC
<straight-shoota> Well, it tries a graceful shutdown. If any requests are still being processed, they'll continue. Can you check if the close method returns or blocks?
oprypin
@oprypin:matrix.org
[m]

@rishavs:

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 have to say, a one-time hurdle that takes up an hour at most doesn't seem reasonable to give up at, considering how big of a followup you're abstaining from.

aaaScript
@aaaScript

<straight-shoota> Well, it tries a graceful shutdown. If any requests are still being processed, they'll continue. Can you check if the close method returns or blocks?

The close method does return, yes.

However, the fiber running the listen method still blocks and doesn't let the fiber close.
From IRC (bridge bot)
@FromIRC
<straight-shoota> Hm, that's odd. Server#close should close all the listening sockets, so accept on them should fail at that point
aaaScript
@aaaScript
I think it seems to be extremely specific to my code and the use of Granite since I'm not able to replicate it into a smaller file. I'm creating HTTP::Server objects dynamically based on host/port attributes created from Granite models. I think that is causing some weird issues. I'll try to look into it and report back if I determine anything from it.
didactic-drunk
@didactic-drunk
@aaaScript 1) Are you using -Dpreview_mt? 2) After .close what is the socket listen state? Can you check with netstat -ln?
aaaScript
@aaaScript
I am not. Also after running netstat the socket is still in a LISTEN state.
didactic-drunk
@didactic-drunk
Are you closing the socket directly or via http.close?
If you're closing the socket directly the bug is fixed in master
aaaScript
@aaaScript
I'm doing it via http.close. I'll try to dissect it some more or play with different ways of closing it.
didactic-drunk
@didactic-drunk
Before and after close
p http.@sockets.map(&.closed?)
p http.@sockets # or
Quinton Miller
@HertzDevil
anyone want to try out compiler-explorer/compiler-explorer#2732 locally
Ali Naqvi
@naqvis
Thank you @HertzDevil :thumbsup:
needing some help here
aaaScript
@aaaScript

Before and after close

p http.@sockets.map(&.closed?)
p http.@sockets # or

@didactic-drunk it's actually returning empty arrays for me before and after. It's kind of odd. Maybe something is happening after the #listen method that is causing some issue?

# Before Close
[]
[]
# After Close
[]
[]
didactic-drunk
@didactic-drunk
@aaaScript Empty @sockets explains why close doesn't work. p @sockets before & after bind & listen(). The array probably gets nuked after listen or it wouldn't accept connections at all
Rishav Sharan
@rishavs
does anyone here uses Sublime Text 4 for crystal dev work? How is the IDE support on sublime. I see that the sublime plugin calls out support for only 2/3 and has fairly slow development.
I am having issues with VS Code and was thinking of trying out alternatives
From IRC (bridge bot)
@FromIRC
<Guest12> Hi all. I am wondering if anyone has a suggestion for creating cross platform UI. I need to target Android specifically so I thought web base would be logical. Although I don't want to touch html/CSS etc. I was hoping there would be a way to make, say imgui, accessable to an android client via http or the like.
<Guest12> Or if any of the current web frameworks for crystal have a built in UI builder that is able to be constructed from within crystal.
From IRC (bridge bot)
@FromIRC
<jhass[m]> you gonna have a hard time with crystal there right now honestly, also because for Android 32 bit ARM is still a relevant target and not even our 64 bit ARM support is in perfect shape
<jhass[m]> Have a look at Flutter maybe
Chris Watson
@watzon
@rishavs VS Code currently has the best Crystal support. It's not stellar, but that's more a lack of a decent language server than anything.
From IRC (bridge bot)
@FromIRC
<ua_> he waited whole 6.5 minutes lmao
George Dietrich
@Blacksmoke16
hm?
From IRC (bridge bot)
@FromIRC
<ua_> i mean Guest12
<ua_> and he should just use react / react native if anyone cares about answer to his question lol
Daniel Worrall
@Daniel-Worrall
Oh, did he leave the irc?
From IRC (bridge bot)
@FromIRC
<ua_> no html/css sure, sadly its the world we live in
Chris Watson
@watzon
He said he didn't want to touch HTML/CSS
From IRC (bridge bot)
@FromIRC
<ua_> yeah
Chris Watson
@watzon
Flutter is the way imo
Daniel Worrall
@Daniel-Worrall
Flutter is nice
Rishav Sharan
@rishavs
flutter is indeed his best bet
George Dietrich
@Blacksmoke16
just return JSON
who needs a UI
Chris Watson
@watzon
++
UIs are for chumps
George Dietrich
@Blacksmoke16
ascii art formatted tables
Chris Watson
@watzon
Just emulate VIM
Rishav Sharan
@rishavs
just hire mimes to read the json and act on it
aaaScript
@aaaScript

@aaaScript Empty @sockets explains why close doesn't work. p @sockets before & after bind & listen(). The array probably gets nuked after listen or it wouldn't accept connections at all

@didactic-drunk It returns socket output after bind_tls and listen as expected. However, it just seems to get wiped like you mentioned. It's kind of weird. I'm not overwriting the object or anything.