Jump to page: 1 2 3
Thread overview
vibe.d and my first web service
Jul 18, 2020
Mr. Backup
Jul 18, 2020
aliak
Jul 18, 2020
Andre Pany
Jul 18, 2020
Mr. Backup
Jul 19, 2020
bauss
Aug 12, 2020
James Blachly
Aug 12, 2020
Daniel Kozak
Aug 12, 2020
James Blachly
Aug 13, 2020
Adam D. Ruppe
Aug 13, 2020
James Blachly
Aug 13, 2020
WebFreak001
Aug 13, 2020
mw
Aug 13, 2020
Mr. Backup
Aug 17, 2020
aberba
Aug 20, 2020
ddcovery
Aug 20, 2020
ddcovery
Aug 20, 2020
Andre Pany
Aug 21, 2020
ddcovery
Aug 21, 2020
ddcovery
Aug 21, 2020
aberba
Aug 23, 2020
Pierce Ng
Aug 23, 2020
Andre Pany
Aug 23, 2020
Pierce Ng
Aug 20, 2020
Ben
Nov 29, 2020
James Blachly
July 18, 2020
Hello,

I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example:

import vibe.vibe;

void main()
{
	auto settings = new HTTPServerSettings;
	settings.port = 8080;
	settings.bindAddresses = ["::1", "127.0.0.1"];
	listenHTTP(settings, &hello);

	logInfo("Please open http://127.0.0.1:8080/ in your browser.");
	runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
	res.writeBody("Hello, World!");
}



I started the program with "dub" command and everything worked as I expected. Except that there were a lot "deprecation" warnings and long time to compile.But when I exit the service by ctrl + c and start again the program cannot start again with error message:

Failed to listen on ::1:8080
Failed to listen on 127.0.0.1:8080
Failed to listen for incoming HTTP connections on any of the supplied interfaces.

or

leaking eventcore driver because there are still active handles


Probably the application was terminated incorrectly. What should I do to ensure that the application closes properly?

Thank you in advance
July 18, 2020
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
> Hello,
>
> I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example:
>
> [...]

Think it's just Vibe.d:

I had a similar issue: https://github.com/vibe-d/vibe.d/issues/2436

And this is still open (default server doesn't clean itself up): https://github.com/vibe-d/vibe.d/issues/2245

July 18, 2020
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
> Hello,
>
> I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example:
>
> import vibe.vibe;
>
> void main()
> {
> 	auto settings = new HTTPServerSettings;
> 	settings.port = 8080;
> 	settings.bindAddresses = ["::1", "127.0.0.1"];
> 	listenHTTP(settings, &hello);
>
> 	logInfo("Please open http://127.0.0.1:8080/ in your browser.");
> 	runApplication();
> }
>
> void hello(HTTPServerRequest req, HTTPServerResponse res)
> {
> 	res.writeBody("Hello, World!");
> }
>
>
>
> I started the program with "dub" command and everything worked as I expected. Except that there were a lot "deprecation" warnings and long time to compile.But when I exit the service by ctrl + c and start again the program cannot start again with error message:
>
> Failed to listen on ::1:8080
> Failed to listen on 127.0.0.1:8080
> Failed to listen for incoming HTTP connections on any of the supplied interfaces.
>
> or
>
> leaking eventcore driver because there are still active handles
>
>
> Probably the application was terminated incorrectly. What should I do to ensure that the application closes properly?
>
> Thank you in advance

I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your problem:

​"versions": [ "VibeHighEventPriority" ]

(Restart your pc)

Vibe.d 0.9 0 will be released soon. I hope it will work out of the box there.

Kind regards
Andre
July 18, 2020
On Saturday, 18 July 2020 at 12:16:09 UTC, Andre Pany wrote:
> On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
>> [...]
>
> I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your problem:
>
> ​"versions": [ "VibeHighEventPriority" ]
>
> (Restart your pc)
>
> Vibe.d 0.9 0 will be released soon. I hope it will work out of the box there.
>
> Kind regards
> Andre

Thank you, it really works. But I dont feel good from it. There are many warnings during compiling. I will rather try to create my own web service only based on standard library. And hunt-http looks pretty good too.
July 18, 2020
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:

> by ctrl + c and start again the program cannot start again with error message:
>
> Failed to listen on ::1:8080
> Failed to listen on 127.0.0.1:8080
> Failed to listen for incoming HTTP connections on any of the supplied interfaces.

https://github.com/vibe-d/vibe-core/issues/205

-Steve
July 19, 2020
On Saturday, 18 July 2020 at 17:23:06 UTC, Mr. Backup wrote:
> On Saturday, 18 July 2020 at 12:16:09 UTC, Andre Pany wrote:
>> On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
>>> [...]
>>
>> I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your problem:
>>
>> ​"versions": [ "VibeHighEventPriority" ]
>>
>> (Restart your pc)
>>
>> Vibe.d 0.9 0 will be released soon. I hope it will work out of the box there.
>>
>> Kind regards
>> Andre
>
> Thank you, it really works. But I dont feel good from it. There are many warnings during compiling. I will rather try to create my own web service only based on standard library. And hunt-http looks pretty good too.

The deprecation warnings are fine, it's just due to changes in DMD. They will eventually be fixed and ruled out as well.

They don't really do anything.

hunt-http is not really stable compared to vibe.d and there aren't much documentation either as it's in the beginning development phase I believe.

I use vibe.d in production with thousands of users on my sites and everything works just fine so don't worry about it. vibe.d is fairly stable.
August 12, 2020
On 7/18/20 8:16 AM, Andre Pany wrote:
> On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
>> ...
>> I started the program with "dub" command and everything worked as I expected. Except that there were a lot "deprecation" warnings and long time to compile.But when I exit the service by ctrl + c and start again the program cannot start again with error message:
>> ...
> 
> I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your problem:
> 
> ​"versions": [ "VibeHighEventPriority" ]
> 
> (Restart your pc)
> 
> Vibe.d 0.9 0 will be released soon. I hope it will work out of the box there.

Unfortunately the problem still occurs with Vibe.d 0.9.0

IMO **this is the single most important problem to fix** for vibe.d -- if the most basic of examples (indeed, supplied by dub itself) fails so spectacularly, the casual new user will not spend the time to find out why this is happening, but instead move on. The ctrl-C non-termination bug has existed since at least 2015 from what I can tell from the forums.

Tangent:

Does Sönke have a Patreon or the project an OpenCollective etc. ? I would be willing to support fixing of some of these bugs.

Alternatively, could we vote on whether a web framework is worthy of foundation support? Having an ergonomic, workable web framework is absolutely essential to surviving as a language in 2020 (notable exception being 800# gorilla incumbents C/C++).
August 12, 2020
On Wed, Aug 12, 2020 at 3:51 PM James Blachly via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:

> Unfortunately the problem still occurs with Vibe.d 0.9.0
>
> IMO **this is the single most important problem to fix** for vibe.d -- if the most basic of examples (indeed, supplied by dub itself) fails so spectacularly, the casual new user will not spend the time to find out why this is happening, but instead move on. The ctrl-C non-termination bug has existed since at least 2015 from what I can tell from the forums.
>
> Tangent:
>
> Does Sönke have a Patreon or the project an OpenCollective etc. ? I would be willing to support fixing of some of these bugs.
>
> Alternatively, could we vote on whether a web framework is worthy of foundation support? Having an ergonomic, workable web framework is absolutely essential to surviving as a language in 2020 (notable exception being 800# gorilla incumbents C/C++).
>

Unfortunately, I think vibe-d is dead. With every release it is worse than before and it seems there is almost no activity. So D really need new champion here maybe hunt will be next champion.


August 12, 2020
On 8/12/20 5:11 PM, Daniel Kozak wrote:
> On Wed, Aug 12, 2020 at 3:51 PM James Blachly via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com <mailto:digitalmars-d-learn@puremagic.com>> wrote:
> 
>     Unfortunately the problem still occurs with Vibe.d 0.9.0
> 
>     IMO **this is the single most important problem to fix** for vibe.d --
>     if the most basic of examples (indeed, supplied by dub itself) fails so
>     spectacularly, the casual new user will not spend the time to find out
>     why this is happening, but instead move on. The ctrl-C non-termination
>     bug has existed since at least 2015 from what I can tell from the
>     forums.
> 
>     Tangent:
> 
>     Does Sönke have a Patreon or the project an OpenCollective etc. ? I
>     would be willing to support fixing of some of these bugs.
> 
>     Alternatively, could we vote on whether a web framework is worthy of
>     foundation support? Having an ergonomic, workable web framework is
>     absolutely essential to surviving as a language in 2020 (notable
>     exception being 800# gorilla incumbents C/C++).
> 
> 
> Unfortunately, I think vibe-d is dead. With every release it is worse than before and it seems there is almost no activity. So D really need new champion here maybe hunt will be next champion.

Breaking out into new thread outside `learn` newsgroup.

I worry you are right, although some of the ideas from vibe-d are outstanding (compile time introspection -> routing table in particular), not present in many other web frameworks, and deserve another chance.

Looked briefly at hunt but of course docs are lacking, and the killer performance on the techempower plaintext and JSON benchmarks may simply be related to gaming the system [0] just as many other frameworks do for that metric.

I will reiterate that D really needs a low-friction, high-performance web framework to be considered seriously in many market segments. I wish I could help, but do not have the requisite expertise, which may be in short supply.

James

[0] https://github.com/TechEmpower/FrameworkBenchmarks/blob/0ba4199487d39cd8f9c41ec68e152788e1a803ff/frameworks/D/hunt/http/http/DemoProcessor.d#L45-L49
August 13, 2020
On Wednesday, 12 August 2020 at 13:46:06 UTC, James Blachly wrote:

> ... The ctrl-C non-termination bug has existed since at least 2015 from what I can tell from the forums.

It's such a pity that so many dub packages are not in friction-free mode.

For this particular problem, maybe before it get fixed, can we add to the vibe.d doc suggesting people develop web-server on a virtual machine (e.g. VirtualBox): at least it can reduce some friction to reboot the (virtual) machine more easily.

« First   ‹ Prev
1 2 3