Giter Site home page Giter Site logo

vibe.d's Introduction

vibe.d

vibe.d is a high-performance asynchronous I/O, concurrency and web application toolkit written in D. It already contains many supplemental features such as database support to be able to offer a complete development environment. For more specialized needs, there are also many compatible DUB packages available.

Visit the website at https://vibed.org/ for more information and documentation.

DUB Package Posix Build Status Windows Build Status

Hello Vibe.d

#!/usr/bin/env dub
/+ dub.sdl:
   name "hello_vibed"
   dependency "vibe-d" version="~>0.9.0"
+/
import vibe.vibe;

void main()
{
    listenHTTP("127.0.0.1:8080", (req, res) {
        res.writeBody("Hello Vibe.d: " ~ req.path);
    });

    runApplication();
}

Download this file as hello.d and run it with DUB:

> dub hello.d

(or chmod +x and execute it: ./hello.d)

Alternatively, you can quickstart with examples directly on Open on run.dlang.io.

Project structure

The vibe.d project is structured into multiple repositories:

  • vibe-d (this repository): The high level web and REST framework, HTTP, STMP and Redis/MongoDB functionality
  • vibe-http: HTTP client/server implementation including WebSockets, proxy, sessions etc.
  • vibe-stream: Advanced stream types and TLS stream support
  • vibe-inet: Internet standard functionality (URL, form encoding, HTML encoding, ...)
  • vibe-core: Fiber based I/O and concurrency implementation
  • vibe-serialization: Serialization and structured data format support
  • vibe-container: Container implementations used throughout the project
  • vibe-sdl: SDLang serialization support based on sdlite
  • vibe-compat: Legacy functionality
  • observable: Observable, signal/slot and reactive value implementations
  • diet: pug.js inspired compile-time HTML template system with vibe.web integration
  • eventcore: Low-level abstraction over the operating system's asynchronous I/O facilities

You can find an API overview of the whole project in the API documentation.

Support

Vibe.d supports the 10 latest minor releases of DMD. For example, if the current version is v2.090.1, then v2.089.x, v2.088.x, ... v2.080.x are supported. Note that support for patch release is desireable, but only support for the last patch in a minor is guaranteed.

Additionally, Vibe.d supports all LDC versions that implement the version of a supported frontend (e.g. by the previous rule LDC v1.20.0 implements v2.090.1 and would be supported).

Installation

Instead of explicitly installing vibe.d, it is recommended to use DUB for building vibe.d based applications. Once DUB is installed, you can create and run a new project using the following shell commands:

dub init <name> -t vibe.d
cd <name>
dub

Similarly, you can run an example by invoking dub from any of the example project directories.

Note that on non-Windows operating systems, you also need to have OpenSSL installed - and of course a D compiler. See below for instructions.

Additional setup on Windows

Additional setup on Mac using brew

If you don't have brew installed, install it according to their install instructions.

You can then also install DUB using brew:

brew install dub

(Note: Install brew only if you do not have macports, as they will conflict)

Install DMD using the installer on https://dlang.org/download.html.

Optionally, run ./setup-mac.sh to create a user/group pair for privilege lowering.

Additional setup on Linux (Debian/Ubuntu/Mint)

Install vibe.d's dependencies:

sudo apt-get install libssl-dev

On 32-bit linux: Install DMD-i386

sudo apt-get install g++ gcc-multilib xdg-utils
wget "http://downloads.dlang.org/releases/2.x/2.098.0/dmd_2.098.0-0_i386.deb"
sudo dpkg -i dmd_2.098.0-0_i386.deb

On 64-bit linux: Install DMD-amd64

sudo apt-get install g++ gcc-multilib xdg-utils
wget "http://downloads.dlang.org/releases/2.x/2.098.0/dmd_2.098.0-0_amd64.deb"
sudo dpkg -i dmd_2.098.0-0_amd64.deb

Optionally, run ./setup-linux.sh to create a user/group pair for privilege lowering.

Additional setup on Linux (generic)

You need to have the following dependencies installed:

Optionally, run ./setup-linux.sh to create a user/group pair for privilege lowering.

Additional setup on FreeBSD

Install the DMD compiler and vibe.d's dependencies using portupgrade or a similar mechanism:

sudo portupgrade -PN devel/pkgconf

Optionally, run ./setup-freebsd.sh to create a user/group pair for privilege lowering.

Switching between OpenSSL versions

By default, vibe.d is built against OpenSSL 1.1.x. On systems that use the older 1.0.x branch, this can be overridden on the DUB command line using --override-config vibe-d:tls/openssl-1.0. Alternatively, the same can be done using a sub configuration directive in the package recipe:

SDL syntax:

dependency "vibe-stream:tls" version="~>1.0"
subConfiguration "vibe-stream:tls" "openssl-1.0"

JSON syntax:

{
    ...
    "dependencies": {
        ...
        "vibe-stream:tls": "~>1.0"
    },
    "subConfigurations": {
        ...
        "vibe-stream:tls": "openssl-1.0"
    }
}

Finally, there is a "botan" configuration for using the D port of the Botan library.

vibe.d's People

Contributors

1100110 avatar andrewbenton avatar cybershadow avatar denizzzka avatar deviator avatar dlang-bot avatar eskimor avatar gedaiu avatar geod24 avatar geoffrey-a avatar ilya-stromberg avatar japplegame avatar kubo39 avatar l-kramer avatar marcioapm avatar martinnowak avatar mathias-lang-sociomantic avatar mdondorff avatar nazriel avatar patefacio avatar s-ludwig avatar schuetzm avatar schveiguy avatar skoppe avatar tchaloupka avatar uplinkcoder avatar webfreak001 avatar wilzbach avatar ximion avatar yazd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vibe.d's Issues

examples/http_static_server does not work

I cloned master and tried the examples as follows:

$ cd examples/http_static_server
$ ../../bin/vibe

Then I send a request with Keep-Alive using telnet:

$ telnet localhost 8080
GET / HTTP/1.1
Host: localhost:8080
Keep-Alive: 300
Connection: keep-alive

HTTP/1.1 400 Bad Request
Content-Type: text/plain
Transfer-Encoding: chunked

97a
400 - Bad Request

Invalid request format.

Internal error information:
[email protected](149): Assertion failure

When I remove Keep-Alive: 300 and Connection: keep-alive it works. But Connection: keep-alive is sent by almost all browsers. Thus, it makes vibe.d practically useless when using with a browser.
I'm running Linux. Can somebody reproduce the issue?

Wrong installation under Windows x32 (7 + 2003srv)

After installation:

  1. DMD2 latest build from official site of D lang (dmd2 Windows installer 2.059 ver i386 paltform).
  2. Coping vibe.d sources and Binaries from Github repo.
  3. Adding this /bin to PATH variable of Windows.

I have a next errors:
...
C:\Users...AppData\Local\Temp.rdmd\source\vibe.cmd is not recognized as an internal or external command,
operable program or batch file.

  1. Running command: "vibe" in root directory:
    http://www.habrastorage.com/images/vibe1.png
  2. Running command "run_example http_server" under examples dir of vibe.d:
    http://www.habrastorage.com/images/vibe2.png

Well, there is error with working sources under 2 different machines with Win 7 x86 and Win 2003 server x86.

Thanks!

Scrypt Support

This is not really an "issue" but it is just something that I would be really great to have in Vibe.d. It is a great way to encrypt sensitive information, I noticed that there are support for md5.

Cheers!

Better errors for remote services

I was doing some testing and forgot to start the mongo db on my local machine, rather than getting a useful message, I was presented with an error something along the lines of "socket error 33". This is very unhelpful.

If I get around to it, I will add something to the mongo code to check the connection, but "socket error 33" is not a helpful diagnostic.

Templates compiled several times

Why is 'index.dt' compiled twice?

$ ./vibe
[7F909F498F00:00000000 INF] Updating application in '/home/simendsjo/code/tmp/vibetest'
[7F909F498F00:00000000 INF] You are up to date
Compiling diet template 'index.dt'...
Compiling diet template 'index.dt'...
[7FB038528F00:00000000 WRN] Failed to parse config file /etc/vibe/vibe.conf: /etc/vibe/vibe.conf: No such file or directory
[7FB038528F00:00000000 INF] Listening on 0.0.0.0 port 8080 succeeded
[7FB038528F00:00000000 ERR] Error binding listening socket
[7FB038528F00:00000000 INF] Listening on :: port 8080 failed
[7FB038528F00:00000000 INF] Running event loop...

deps.txt can't be opened

If I run vibe twice in a row, the second time I get this error:

object.Exception@/home/matt/code/vibe.d/bin/../source/vibe/core/drivers/threadedfile.d(79): Failed to open 'deps.txt' for writing.
----------------
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(vibe.core.driver.FileStream vibe.core.drivers.libevent2.Libevent2Driver.openFile(immutable(char)[], vibe.core.driver.FileMode)+0x6a) [0x528fce]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(vibe.core.driver.FileStream vibe.core.file.openFile(immutable(char)[], vibe.core.driver.FileMode)+0x31) [0x5410d1]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(void vibe.vpm.vpm.Vpm.createDepsTxt()+0x89) [0x51e27d]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(void vpm._staticCtor1()+0x160) [0x4d1d68]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(void vpm.__modctor()+0x9) [0x4fa071]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(extern (C) void rt.minfo.rt_moduleTlsCtor().void runModuleFuncs!(rt_moduleTlsCtor11__lambda232).runModuleFuncs(object.ModuleInfo*[])+0x3c) [0x5507b0]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(rt_moduleTlsCtor+0x18) [0x550098]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x1d) [0x54bbc1]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x54b513]
/tmp/.rdmd-1000/home/matt/code/vibe.d/bin/vpm.d.228FB9D98FA72CFF8B934DD31B954B79(main+0xd3) [0x54b4ab]
/lib/libc.so.6(__libc_start_main+0xf5) [0x7f416d150455]

The file deps.txt has this weird mode: -r-xr-Sr--
If it was created with a normal -rw-r--r-- mode, it would be able to write it the second time as well.

Relational databases not planned?

I don't see any notes it todo.txt to support MySQL, SQLite or PostgreSQL. Given these are well known, and still widely popular, I think it makes sense to include them. At least MySQL and SQLite.

vpm fails second time it starts when I have dependencies

It references vibelog, but this is my package.json:
{
"name": "vibetest",
"version": "0.0.1",
"author": "simendsjo",
"dependencies": {
"mysql-native": ">=0.0.1"
}
}

First time running

$ ./vibe
[7F0B8C308F00:00000000 INF] Updating application in '/home/simendsjo/code/tmp/vibetest'
[7F0B8C308F00:00000000 INF] The following changes could be performed:
[7F0B8C308F00:00000000 INF] Installupdate: mysql-native, version >=0.0.1
[7F0B8C308F00:00000000 INF] Installing mysql-native...
[7F0B8C308F00:00000000 INF] mysql-native has been installed with version 0.0.1
[7F0B8C308F00:00000000 INF] There are still some actions to perform:
[7F0B8C308F00:00000000 INF] Uninstall: vibelog, ==0.0.1
[7F0B8C308F00:00000000 INF] InstallUpdate: mysql-native, >=0.0.1

And if I run it again:

$ ./vibe
[7FB755C8EF00:00000000 INF] Updating application in '/home/simendsjo/code/tmp/vibetest'
[7FB755C8EF00:00000000 INF] The following changes could be performed:
[7FB755C8EF00:00000000 INF] Uninstall: vibelog, version ==0.0.1
[7FB755C8EF00:00000000 INF] Installupdate: mysql-native, version >=0.0.1
[7FB755C8EF00:00000000 INF] Uninstalling vibelog
object.Exception@../../vibe/vibe.d/bin/../source/vibe/vpm/vpm.d(501): Uninstall failed, no journal found for 'vibelog'. Please uninstall manually.

/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(bool vibe.vpm.vpm.Vpm.update(bool)+0x2bf) [0x535313]
/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(_Dmain+0x155) [0x4d7805]
/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17) [0x55b45f]
/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x55addf]
/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x3d) [0x55b4ad]
/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x55addf]
/tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/../../vibe/vibe.d/bin/vpm.d.F62B49216E43CDABBD891C9FA8DD043C(main+0xd3) [0x55ad77]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fb75472c30d]

Idiomatic way to process "heavy" work in handlers?

If I fetch some rows from a database in a handler, the site slows to a crawl as all requests are blocked while fetching and processing the rows. How am I supposed to write code like this without blocking all requests?

void somepage(...)
{
  foreach(row; db.getRows())
    process();
  render!(page);
}

urlEncode doesn't properly handle < 0x10

When trying to urlEncode a perfectly reasonable string containing newlines (%0a), they are encoded as %a which is incorrect and isn't properly parsed by other clients.

This is also affecting tabs. Other non-printables are probably unlikely to be used in URL encoding.

In my case I was trying to encode a multi-line string to place in a fragment for a link to translate.google.com. When properly encoded it happily accepts these strings.

I suppose the problem is here:
https://github.com/rejectedsoftware/vibe.d/blob/c8a03f93639ada7a307ea7dd3db0db909275a646/source/vibe/textfilter/urlencode.d#L44

-[Unknown]

weird log and template rendering

vibe.d master (cloned from github)

ubuntu 12.04 64bit

getting this when starting vibe:

tomek@tomek-U36SD:~/d_apps/hellovibe$ vibe
[7FE56073AF00:00000000 INF] Updating application in '/home/tomek/d_apps/hellovibe'
[7FE56073AF00:00000000 WRN] There was no 'package.json' found for the application in '/home/tomek/d_apps/hellovibe'.
[7FE56073AF00:00000000 INF] You are up to date
object.Exception@/opt/vibe.d/bin/../source/vibe/core/drivers/threadedfile.d(79): Failed to open 'deps.txt' for reading.
----------------
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(vibe.core.driver.FileStream vibe.core.drivers.libevent2.Libevent2Driver.openFile(immutable(char)[], vibe.core.driver.FileMode)+0x6a) [0x51cfe2]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(vibe.core.driver.FileStream vibe.core.file.openFile(immutable(char)[], vibe.core.driver.FileMode)+0x31) [0x505e89]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(void vibe.vpm.vpm.Vpm.createDepsTxt()+0x89) [0x50e9ed]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(void vpm._staticCtor1()+0x160) [0x4b9ec0]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(void vpm.__modctor()+0x9) [0x4e1d81]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(extern (C) void rt.minfo.rt_moduleTlsCtor().void runModuleFuncs!(rt_moduleTlsCtor11__lambda232).runModuleFuncs(object.ModuleInfo*[])+0x3c) [0x537734]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(rt_moduleTlsCtor+0x18) [0x53701c]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x1d) [0x532b45]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x532497]
/tmp/.rdmd-1000/opt/vibe.d/bin/vpm.d.05B4E9898F0B6D9B495DEE2FFE14FE71(main+0xd3) [0x53242f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fe55f11076d]
----------------
Compiling diet template 'index.dt'...
Compiling diet template 'show.dt'...
Compiling diet template 'index.dt'...
Compiling diet template 'show.dt'...
[7FA01BB12F00:00000000 WRN] Failed to parse config file /etc/vibe/vibe.conf: /etc/vibe/vibe.conf: No such file or directory
[7FA01BB12F00:00000000 INF] Listening on 0.0.0.0 port 8080 succeeded
[7FA01BB12F00:00000000 ERR] Error binding listening socket
[7FA01BB12F00:00000000 INF] Listening on :: port 8080 failed
[7FA01BB12F00:00000000 INF] Running event loop...

While the application seems to work, two weird issues creep out:

  • the rendered html is
<!DOCTYPE html>
<html></html>
<div>head</div>
<div>title Example page</div>
<div>body</div>
<div>block body</div>

instead of, well, "Example page" being in the title tag etc.

  • /users/foo renders exactly the same template as index, although the function body seems to be fine:
  void show(HttpServerRequest req, HttpServerResponse res)
  {
    auto output = res.bodyWriter();
    parseDietFile!("show.dt", req)(output);
  }

How to manually build site

I get a segfault while compiling a diet template:

Compiling diet template 'user.details.dt'...
Segmentation fault

bin/vibe now creates an executable called vpm. Trying to run this directly in order to debug is a little unintuitive.. I can make it check for modules, but not run the application. Any tips on how I can debug this?

Broken examples

Using Windows and DMD 2.058, the following examples do not compile.

JSON
redis
mongodb
daytime
info

Similar problems with Debian DMD 2.058 AMD64.

Cannot run "vibe" without having symbolic link

If I launch "vibe" directly, without going through a symbolic link, this happens:
$ vibe
dirname: missing operand
Try `dirname --help' for more information.
sh: cannot create /vpm.d.deps: Permission denied
Failed: 'dmd' '-g' '-w' '-property' '-I/../source' '-L-levent' '-L-levent_openssl' '-L-lssl' '-L-lcrypto' '-Jviews' '-Isource' '-v' '-o-' '/vpm.d' '-I/'
source/app.d(1): Error: module d is in file 'vibe/d.d' which cannot be read
import path[0] = /../source
import path[1] = source
import path[2] = source
import path[3] = /home/simendsjo/.dvm/compilers/dmd-2.059/bin/../src/phobos
import path[4] = /home/simendsjo/.dvm/compilers/dmd-2.059/bin/../src/druntime/import
Failed: 'dmd' '-g' '-w' '-property' '-I/../source' '-L-levent' '-L-levent_openssl' '-L-lssl' '-L-lcrypto' '-Jviews' '-Isource' '-v' '-o-' 'source/app.d' '-Isource'

Diet template does not support soft tab indent

When using soft tab (2 spaces as a tab) with index.jd, like:

extends layout.jd
block body
  h1 Example page - Home
  p Hello, World!

vibe complains about

diet.d(137): Error: "Error in template index.jd line 3: Inside an extension template, only 'block' tags are allowed at root level.(diet.d:169)"

I think its because diet does not recognize soft tab as an indent and regards h1 Example ... as a new block, hence the error.

Should that be supported? I found that jade-lang.org are using soft tab in there examples

Improve README.md

Remove the ./install.sh parts as long as there is no install.sh.
The main header should be "vibe.d" and ther should be a short introductory paragraph before the index.
Index could also be removed.

Error listening, but site is served anyway

It tries to bind to the same port twice..?

[7FA48783CF00:00000000 WRN] Failed to parse config file /etc/vibe/vibe.conf: /etc/vibe/vibe.conf: No such file or directory
[7FA48783CF00:00000000 INF] Listening on 0.0.0.0 port 8080 succeeded
[7FA48783CF00:00000000 ERR] Error binding listening socket
[7FA48783CF00:00000000 INF] Listening on :: port 8080 failed
[7FA48783CF00:00000000 INF] Running event loop...

Cannot update modules

./vibe
[7F6ECE470F00:00000000 INF] Updating application in '/home/simendsjo/code/tmp/vibetest2'
[7F6ECE470F00:00000000 ERR] Trying to get package metadata failed, exception: [email protected](528): Assertion failure
----------------
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(_d_assertm+0x2a) [0x56dc62]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D() [0x59a291]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(void[] std.zlib.UnCompress.flush().void __require()+0x26) [0x59b0de]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(void[] std.zlib.UnCompress.flush()+0x16) [0x59aec6]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(void vibe.stream.zlib.ZlibInputStream.readChunk()+0x133) [0x508dff]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(void vibe.stream.zlib.ZlibInputStream.read(ubyte[])+0x14d) [0x508cc1]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(ubyte[] vibe.stream.stream.readAll(vibe.stream.stream.InputStream, ulong)+0x110) [0x54ebb4]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(vibe.data.json.Json vibe.vpm.registry.RegistryPS.metadata(const(immutable(char)[]))+0x278) [0x506598]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(vibe.data.json.Json vibe.vpm.registry.RegistryPS.bestPackage(const(immutable(char)[]), const(vibe.vpm.dependency.Dependency))+0x27) [0x506727]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(vibe.data.json.Json vibe.vpm.registry.RegistryPS.packageJson(const(immutable(char)[]), const(vibe.vpm.dependency.Dependency))+0x62) [0x506306]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(_D4vibe3vpm3vpm11Application7actionsMxFC4vibe3vpm15packagesupplier15PackageSupplieriZAS4vibe3vpm3vpm6Action17__foreachbody3053MFKAyaKS4vibe3vpm10dependency19RequestedDependencyZi+0x108) [0x544964]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(_aaApply2+0x62) [0x56cdde]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(const(vibe.vpm.vpm.Action[] function(vibe.vpm.packagesupplier.PackageSupplier, int)) vibe.vpm.vpm.Application.actions+0x1ba) [0x544526]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(bool vibe.vpm.vpm.Vpm.update(int)+0x63) [0x54662b]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(_Dmain+0x471) [0x4e69dd]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17) [0x56e50f]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x56de8f]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x3d) [0x56e55d]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x56de8f]
/tmp/.rdmd-1000/tmp/vpm.d.76976170AC35F5295A68BD603250DC1D(main+0xd3) [0x56de27]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f6ecd2c130d]
[7F6ECE470F00:00000000 WRN] Could not resolve dependencies
[7F6ECE470F00:00000000 ERR] The dependency graph could not be filled.
[7F6ECE470F00:00000000 INF] The following changes could be performed:
[7F6ECE470F00:00000000 INF] Failure: mysql-native, version >=0.0.1

Why does this warning message pop up?

When a connection hasn't been used in a while, this message appears:
[7F3C31AC6F00:7F3C31ACAC80 WRN] Handling of connection failed: Operating on closed TCPConnection.

Is this really a warning? What is vibe trying to do here?

Make homepage public

Not sure if this has been addressed already, but the homepage should be made public on github so we can create pull requests

Use Deimos headers for C libraries?

Were the Deimos headers for OpenSSL/libevent/libev [1] not used on purpose, e.g. in order to avoid an external dependency or because they were buggy, or were they just not available when you needed them?

The main reason why I'm asking is that HtoD-generated bindings usually contain a few inaccuracies, e.g. C long being translated to D long, which of course fails on x86_64/LP64.

[1] The former two of which I happen to have contributed, but that's not the point here. ;)

Error running examples on CentOS 6.2: /usr/bin/ld: cannot find -levent_pthreads

Topic says it all really.

$ ./run_example.sh daytime
/usr/bin/ld: cannot find -levent_pthreads
collect2: ld returned 1 exit status
--- errorlevel 1

I have the event-devel package installed, but it doesn't seem to have an event_pthreads library.

$ ls /usr/lib64 | grep event
libevent-1.4.so.2
libevent-1.4.so.2.1.3
libevent.a
libevent_core-1.4.so.2
libevent_core-1.4.so.2.1.3
libevent_core.a
libevent_core.so
libevent_extra-1.4.so.2
libevent_extra-1.4.so.2.1.3
libevent_extra.a
libevent_extra.so
libevent.so
libxcb-event.so.1
libxcb-event.so.1.0.0

I can't find much on the intertubes about the library, either. Is it a version thing? The package I have installed is libevent-devel-1.4.13-1.el6 (x86_64).

This is on CentOS 6.2 AMD64. Thanks!

Linker errors on homepage example

Using the "Example of a simple HTTP server" example from the vibe.d homepage, and compiling (Win, DMD 2.059) with this:

>rdmd -I[path-to-vibe.d]\source [path-to-vibe.d]\lib\win-i386\event2.lib [path-to-vibe.d]\vibe.d\lib\win-i386\eay.lib [path-to-vibe.d]\lib\win-i386\ssl.lib app.d

I get this:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _setsockopt@20
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _WSAStartup@8
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _shutdown@8
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _socket@12
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _accept@12
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _bind@12
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-app.d-3A45E6B90D932E97B6FB3AF37F8FC3CE\app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE.obj(app-d-3A45E6B90D932E97B6FB3AF37F8FC3CE)
 Error 42: Symbol Undefined _listen@8
--- errorlevel 7

HTTP header library

I have some (old) code to parse and format http headers. It uses the ragel (http://www.complang.org/ragel/) parser generator to generate the parsers.

I originally wanted to post this for inclusion into phobos, however Andrei made it pretty clear that he doesn't want code in phobos which depends on external tools. So I currently have no real use for this code, if it's useful for vibe.d I'd be happy to contribute it.

Source code:
https://gist.github.com/2516504#file_http.rl.d

Compilable source code (generated by ragel, compile with deprecated code enabled)
https://gist.github.com/2516504#file_http.d

Documentation:
http://dl.dropbox.com/u/24218791/d/src/http.html
(the interesting part is canParseHeader, isHeader, canFormatHeader, formatHeader, formatHeaderValue, parseHeader, parseHeaderValue)

Some refactoring is probably necessary, but I first want to know if there's some interest in this code.

"vibe" linker errors on Win

On windows, when I put vibe's bin dir in my PATH and run "vibe" I just get this:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url4Path14toNativeStringMxFZAya
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4core4file8openFileFAyaE4vibe4core6driver8FileModeZC4vibe4core6driver10FileStream
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe6stream6stream12OutputStream11__InterfaceZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe6stream6stream12OutputStream5writeMFxAabZv
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe3vpm8registry10RegistryPS6__ctorMFS4vibe4inet3url3UrlZC4vibe3vpm8registry10RegistryPS
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url3Url5parseFAyaZS4vibe4inet3url3Url
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe3vpm3vpm3Vpm6__ctorMFS4vibe4inet3url4PathC4vibe3vpm15packagesupplier15PackageSupplierZC4vibe3vpm3vpm3Vpm
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4core3log11setLogLevelFNbE4vibe4core3log8LogLevelZv
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url4Path6__initZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url4Path6__ctorMFAyaZS4vibe4inet3url4Path
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe3vpm8registry10RegistryPS7__ClassZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe3vpm3vpm3Vpm7__ClassZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4core3log10s_minLevelE4vibe4core3log8LogLevel
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url3Url8toStringMxFZAya
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url8__assertFiZv
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url9PathEntry11__xopEqualsFxPvxPvZb
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url9PathEntry8toStringMxFZAya
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url9PathEntry5opCmpMxFKxS4vibe4inet3url9PathEntryZi
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url7__arrayZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url4Path8absoluteMxFNdZb
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url4Path8toStringMxFbZAya
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4inet3url12__ModuleInfoZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4vibe12__ModuleInfoZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe3vpm3vpm12__ModuleInfoZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4core4file12__ModuleInfoZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe3vpm8registry12__ModuleInfoZ
C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\rdmd-vpm.d-146A64229ADA97795C1C597898480C31\vpm.obj(vpm) 
 Error 42: Symbol Undefined _D4vibe4core3log12__ModuleInfoZ
--- errorlevel 27
'C:\DOCUME~1\NICKSA~1\LOCALS~1\Temp\.rdmd\source\vibe.cmd' is not recognized as an internal or external command,
operable program or batch file.

I'm using DMD 2.059

[Diet] proposal for diet function support

Diet template currently has layout/extends support, and that's one of the two directions diet template relations. The other is template inclusion. Issue #32 addresses this.

My proposal is to support embeded template support, which I call a diet function



def css(filename)
    link(rel="stylesheet", type="text/css", href="/css/#{filename}.css")
    

Then in the same diet template, we could call this diet function


block head append
    call css("bootstrap")

And this would have the same effect with:


block head append
    link(rel="stylesheet", type="text/css", href="/css/bootstrap.css")

In this way user can declare their own functions to alleviate template writing.

we can call a diet function defined in another diet template:


    call another_template.css("bootstrap")

In child templates, we can call diet functions defined in its parent with


    call super.css("bootstrap")

if we call the render function, then it's then same as including another template


    call another_template.render(args...)

same as


    call another_template(args...)

In conclusion, diet function introduces three keywords: def, call, super, and its functionality would be a super set of simple template inclusion mechanizm. With diet functions, it's easy for a developer to define his own set of utility functions, and call them where ever they want.

The syntax is not important, in Play!framework (a web framework in Scala), they use @ symbol to do both def and call, and even evaluation

e.g.

definition


    @hello(name: String) {
        <p>Hello @name </p>
    }

calling


    ...
    @hello("david")
    ...

calling another template's function


    ...
    @another_template.hello("david")
    ...

Every Play template is a class. So they are just another way to define and call methods.

P.S. I took a look at diet template's code, and there are a bunch of d templates and CTFE code, which is beyond my ability (I'm a D newbie). Can you explain how Diet template is designed? maybe in a blog if you have time. When I'm much better at D coding, I will try to help :) I really am wishing vibe.d goes successful.

I imagined that a diet template is compiled into a class, with a render method. And layout extends are implemented by subclasses, whose render method calls super's render method. template inclusion would be implemented by calling render method in another template's class. Is this comprehension correct ?

Performance test

Hi everyone!
I just tested vibe.d vs nodejs and got pity results...
I wrote (Ctrl+C) two simples apps:
(Vibe.d)
void handleRequest(HttpServerRequest req, HttpServerResponse res)
{ res.writeBody(cast(ubyte[])"Hello, World!", "text/plain");}
static this()
{ setLogLevel(LogLevel.Trace);
auto settings = new HttpServerSettings;
settings.port = 8080;
listenHttp(settings, &handleRequest);}
And nodejs
var sys = require('sys'),
http = require('http');
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('

Hello World

');
res.end();
}).listen(8080);
Test with
ab -r -n 100000 -c 1000 http://127.0.0.1:8080/
And got results(vibe.d):
Concurrency Level: 1000
Time taken for tests: 515.134 seconds
Complete requests: 100000
Failed requests: 7662
(Connect: 0, Receive: 2554, Length: 2554, Exceptions: 2554)
Write errors: 0
Total transferred: 13155885 bytes
HTML transferred: 1266863 bytes
Requests per second: 194.12 #/sec
Time per request: 5151.341 ms
Time per request: 5.151 [ms](mean, across all concurrent requests)
Transfer rate: 24.94 [Kbytes/sec] received

Results(nodejs):
Concurrency Level: 1000
Time taken for tests: 16.212 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 8100000 bytes
HTML transferred: 1800000 bytes
Requests per second: 6168.42 #/sec
Time per request: 162.116 ms
Time per request: 0.162 [ms](mean, across all concurrent requests)
Transfer rate: 487.93 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 97 640.7 0 9028
Processing: 0 23 50.2 20 9831
Waiting: 0 22 50.2 20 9831
Total: 1 120 648.4 21 9831

I understand that vibe is very young project , but my I did something wrong?

Should HttpServerErrorInfo.exception ever be null?

For page not found, exception is set to null. Would it make more sense if this would be set as some HttpException?
I actually think HttpServerErrorInfo could be an exception: HttpException, containing the http errorcode and exception chaining. That way, you could throw HttpException with regular http codes from you code, and handle them in the same way in the errorhandler. Of course.. This could be done using injectors, but it would be nice to have all error handling in the same place.

Cannot connect through mysql

It just hangs. I was able to connect before the library was integrated to vibe, so I guess the problem might be there.
I don't know vibe yet - anything in particular you want me to investigate?

writeln("connecting");
auto cn = new Connection("localhost", "user", "password", "vibetest");
writeln("connected");

(gdb) r
Starting program: /home/simendsjo/code/tmp/vibetest/app
[Thread debugging using libthread_db enabled]
[7FFFF7EC8F00:00000000 WRN] Failed to parse config file /etc/vibe/vibe.conf: /etc/vibe/vibe.conf: No such file or directory
[7FFFF7EC8F00:00000000 INF] Listening on 0.0.0.0 port 8080 succeeded
[7FFFF7EC8F00:00000000 ERR] Error binding listening socket
[7FFFF7EC8F00:00000000 INF] Listening on :: port 8080 failed
[7FFFF7EC8F00:00000000 INF] Running event loop...
connecting
^C
Program received signal SIGINT, Interrupt.
0x00007ffff6a29bd3 in __epoll_wait_nocancel () at ../sysdeps/unix/syscall-template.S:82
82 ../sysdeps/unix/syscall-template.S: No such file or directory.
in ../sysdeps/unix/syscall-template.S
(gdb) bt
#0 0x00007ffff6a29bd3 in __epoll_wait_nocancel () at ../sysdeps/unix/syscall-template.S:82
#1 0x00007ffff7bb98e7 in ?? () from /usr/lib/libevent-2.0.so.5
#2 0x00007ffff7ba4c44 in event_base_loop () from /usr/lib/libevent-2.0.so.5
#3 0x00000000004e9952 in vibe.core.drivers.libevent2.Libevent2Driver.runEventLoop() (this=0x7ffff7ecafc0)

at ../../vibe/vibe.d/bin/../source/vibe/core/drivers/libevent2.d:57

#4 0x00000000004ce530 in vibe.core.core.start() () at ../../vibe/vibe.d/bin/../source/vibe/core/core.d:42
#5 0x00000000004fbf64 in D main (args=...) at ../../vibe/vibe.d/bin/../source/vibe/appmain.d:38
#6 0x0000000000557b73 in rt.dmain2.main() ()
#7 0x0000000000822010 in ?? ()
#8 0x00007ffff7ecaf00 in ?? ()
#9 0x00007fffffffdf50 in ?? ()
#10 0x00007fffffffde20 in ?? ()
#11 0x00000000005574f3 in rt.dmain2.main() ()
#12 0x0000000000000001 in ?? ()
#13 0x0000000000000025 in ?? ()
#14 0x0000000000822020 in ?? ()
#15 0x00007fffffffdf50 in ?? ()
#16 0x00007fffffffdc60 in ?? ()
#17 0x0000000000000000 in ?? ()

Exception@../source/vibe/core/drivers/libevent2_tcp.d(287): Operating on closed TCPConnection.

ab -n 10000 -c 1000 http://127.0.0.1:8080/ <=== _OK_ (localhost)

ab -n 10000 -c 1000 http://192.168.2.3:8080/ <=== _EXCEPTION!!!_

_Nginx reverse proxy:
ab -n 10000 -c 1000 http://192.168.2.3/ <=== _EXCEPTION!!!

ab -n 10000 -c 1000 http://127.0.0.1/ <=== _EXCEPTION!!!_

No problem with node.js, tornado or g-wan.

root@ubuntu:/home/ubuntu12/vibe.d/bin# ./run_example.sh simplehttp
[B71F3F80:00000000 WRN] Failed to parse config file /etc/vibe/vibe.conf: /etc/vibe/vibe.conf: No such file or directory
[B71F3F80:00000000 INF] Listening on 0.0.0.0 port 8080 succeeded
[B71F3F80:00000000 ERR] Error binding listening socket
[B71F3F80:00000000 INF] Listening on :: port 8080 failed
[B71F3F80:00000000 INF] Running event loop...
[B71F3F80:00000000 trc] accept
[B71F3F80:00000000 trc] accepted 10
[B71F3F80:00000000 dbg] Creating new fiber...
[B71F3F80:00000000 dbg] initial task call
[B71F3F80:B71F8C80 trc] entering task.
[B71F3F80:B71F8C80 dbg] start task (fd 10).
[B71F3F80:B71F8C80 trc] reading request..
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 dbg] run task out
[B71F3F80:00000000 trc] accept
[B71F3F80:00000000 trc] accepted -1
[B71F3F80:00000000 trc] handled incoming connections...
[B71F3F80:00000000 trc] socket 10 write event (false)!
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 trc] socket 10 read event!
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (14)
[B71F3F80:B71F8C80 trc] req: GET / HTTP/1.1
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (24)
[B71F3F80:B71F8C80 trc] hdr: Host: 192.168.1.3:8080
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (22)
[B71F3F80:B71F8C80 trc] hdr: Connection: keep-alive
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (114)
[B71F3F80:B71F8C80 trc] hdr: User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (71)
[B71F3F80:B71F8C80 trc] hdr: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (34)
[B71F3F80:B71F8C80 trc] hdr: Accept-Encoding: gzip,deflate,sdch
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (31)
[B71F3F80:B71F8C80 trc] hdr: Accept-Language: en-US,en;q=0.8
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (46)
[B71F3F80:B71F8C80 trc] hdr: Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (0)
[B71F3F80:B71F8C80 trc] Got request header.
[B71F3F80:B71F8C80 trc] handle request (body 0)
[B71F3F80:B71F8C80 trc] evbuffer_add (fd 10): 140 B
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] evbuffer_add (fd 10): 13 B
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] reading request..
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 trc] socket 10 write event (false)!
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 dbg] Socket event on fd 10: 65
[B71F3F80:00000000 dbg] Remote host on fd 10 timed out.
[B71F3F80:00000000 trc] resuming corresponding task...
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 dbg] Exception while parsing request: object.Exception@../source/vibe/core/drivers/libevent2_tcp.d(287): Operating on closed TCPConnection.
----------------
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(pure @safe bool std.exception.enforce!(bool, "../source/vibe/core/drivers/libevent2_tcp.d", 287).enforce(bool, lazy const(char)[])+0x2f) [0x80fb1fb]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(ubyte[] vibe.core.drivers.libevent2_tcp.Libevent2TcpConnection.readLine(uint, immutable(char)[])+0xaf) [0x80fa4e3]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(ubyte[] vibe.stream.stream.LimitedInputStream.readLine(uint, immutable(char)[])+0x69) [0x80e13a5]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(vibe.http.server.HttpServerRequest vibe.http.server.parseRequest(vibe.core.driver.TcpConnection)+0x5a) [0x80feb2a]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.http.server.handleHttpConnection(vibe.core.driver.TcpConnection, vibe.http.server.HTTPServerListener)+0x2a8) [0x80fdd08]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.http.server.listenHttpPlain(vibe.http.server.HttpServerSettings, void delegate(vibe.http.server.HttpServerRequest, vibe.http.server.HttpServerResponse)).void __lambda17(vibe.core.driver.TcpConnection)+0x27) [0x80fc7e3]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(extern (C) void vibe.core.drivers.libevent2_tcp.onConnect(int, short, void*).void delegate() client_task(vibe.core.drivers.libevent2_tcp.TcpContext*, vibe.core.drivers.libevent2_tcp.TcpContext*).void __lambda16()+0x8f) [0x80fadb7]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.core.core.defaultFiberFunc()+0x70) [0x80e3154]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void core.thread.Fiber.run()+0x19) [0x8146b39]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(fiber_entryPoint+0x49) [0x8146ad9]
[(nil)]
[B71F3F80:B71F8C80 WRN] Handling of connection failed: Operating on closed TCPConnection.
[B71F3F80:B71F8C80 dbg] object.Exception@../source/vibe/core/drivers/libevent2_tcp.d(287): Operating on closed TCPConnection.
----------------
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(pure @safe bool std.exception.enforce!(bool, "../source/vibe/core/drivers/libevent2_tcp.d", 287).enforce(bool, lazy const(char)[])+0x2f) [0x80fb1fb]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.core.drivers.libevent2_tcp.Libevent2TcpConnection.write(const(ubyte[]), bool)+0x43) [0x80fa71f]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.stream.stream.OutputStream.write(const(char[]), bool)+0x3f) [0x80e0ebf]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.http.server.HttpServerResponse.writeHeader()+0x128) [0x80fd7b0]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(@property vibe.stream.stream.OutputStream vibe.http.server.HttpServerResponse.bodyWriter()+0x1d3) [0x80fd0e3]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.http.server.handleHttpConnection(vibe.core.driver.TcpConnection, vibe.http.server.HTTPServerListener).void errorOut(int, immutable(char)[], immutable(char)[])+0x148) [0x80fea68]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.http.server.handleHttpConnection(vibe.core.driver.TcpConnection, vibe.http.server.HTTPServerListener)+0xddc) [0x80fe83c]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.http.server.listenHttpPlain(vibe.http.server.HttpServerSettings, void delegate(vibe.http.server.HttpServerRequest, vibe.http.server.HttpServerResponse)).void __lambda17(vibe.core.driver.TcpConnection)+0x27) [0x80fc7e3]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(extern (C) void vibe.core.drivers.libevent2_tcp.onConnect(int, short, void*).void delegate() client_task(vibe.core.drivers.libevent2_tcp.TcpContext*, vibe.core.drivers.libevent2_tcp.TcpContext*).void __lambda16()+0x8f) [0x80fadb7]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void vibe.core.core.defaultFiberFunc()+0x70) [0x80e3154]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(void core.thread.Fiber.run()+0x19) [0x8146b39]
/tmp/.rdmd-0/home/ubuntu12/vibe.d/bin/../source/examples/simplehttp.d.52821A90AD271535875DEF3D72F9A9E9(fiber_entryPoint+0x49) [0x8146ad9]
[(nil)]
[B71F3F80:B71F8C80 dbg] task finished.
[B71F3F80:B71F8C80 trc] exiting task.
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 trc] accept
[B71F3F80:00000000 trc] accepted 10
[B71F3F80:00000000 dbg] initial task call
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 trc] entering task.
[B71F3F80:B71F8C80 dbg] start task (fd 10).
[B71F3F80:B71F8C80 trc] reading request..
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 dbg] run task out
[B71F3F80:00000000 trc] accept
[B71F3F80:00000000 trc] accepted -1
[B71F3F80:00000000 trc] handled incoming connections...
[B71F3F80:00000000 trc] socket 10 read event!
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (25)
[B71F3F80:B71F8C80 trc] req: GET /favicon.ico HTTP/1.1
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (24)
[B71F3F80:B71F8C80 trc] hdr: Host: 192.168.1.3:8080
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (22)
[B71F3F80:B71F8C80 trc] hdr: Connection: keep-alive
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (11)
[B71F3F80:B71F8C80 trc] hdr: Accept: */*
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (114)
[B71F3F80:B71F8C80 trc] hdr: User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (34)
[B71F3F80:B71F8C80 trc] hdr: Accept-Encoding: gzip,deflate,sdch
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (31)
[B71F3F80:B71F8C80 trc] hdr: Accept-Language: en-US,en;q=0.8
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (46)
[B71F3F80:B71F8C80 trc] hdr: Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] TCPConnection.readline return data (0)
[B71F3F80:B71F8C80 trc] Got request header.
[B71F3F80:B71F8C80 trc] handle request (body 0)
[B71F3F80:B71F8C80 trc] evbuffer_add (fd 10): 140 B
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] evbuffer_add (fd 10): 13 B
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] bufferevent_flush
[B71F3F80:B71F8C80 trc] reading request..
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield
[B71F3F80:00000000 trc] socket 10 write event (false)!
[B71F3F80:B71F8C80 trc] resume
[B71F3F80:B71F8C80 trc] evbuffer_readln (fd 10)
[B71F3F80:B71F8C80 trc] yield

Vibe no longer shuts down

First trying Ctrl-C, then TERM:

^C[7F2BA5523F00:00000000 INF] Received signal 2. Shutting down.
[7F2BA5523F00:00000000 INF] Received signal 15. Shutting down.

Using vibe and dmd trunk on linux64 (kubuntu)

BSON unable to be wrapped in variant

The following code does not compile:

Bson myBson = ...; //Something valid

auto varBson = Variant(myBson); // Throws error

/usr/include/d/std/variant.d(385): Error: cannot implicitly convert expression ((*zis).opDispatch()) of type Bson to string
/usr/include/d/std/variant.d(543): Error: template instance std.variant.VariantN!(32LU).VariantN.handler!(Bson) error instantiating
/usr/include/d/std/variant.d(493):        instantiated from here: opAssign!(Bson)

Closing cached TcpConnections

Trying to close a TcpConnection from another fiber than created is throws an error. This makes caching TcpConnections hard as I have no way of closing them when the application shuts down.

TcpConnection[Fiber] connections;
static ~this() {
  foreach(fiber, cn; connections)
    cn.close(); // owned by a different fiber
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.