RejectedSoftware Forums

Sign up

running examples

Sorry for very basic question - but, I think I have vibe installed correctly (although I could not use dub because I had issues with libcurl on my ubuntu). I can, for example do:

$ ./run-example.sh json

and will see some json written. But when I run those that involve web stuff I don't think it is working (or I don't know what to look for). For example, if I run the 'diet' example, I see one Failed to listen on 0.0.0.0:8080, which I think is ok since it keeps going and prints Running event loop.... Not sure what to do then. I expected to enter "0.0.0.0:8080" in the browser and see something, but all I see is the error below.

400 - Bad Request

Bad Request

Internal error information:
core.exception.RangeError@vibe.utils.array(92): Range violation
----------------
/tmp/.rdmd-1000/rdmd-app.d-D171C94ECB54675B9965F1B51CDCFF17/app() [0x51dc22]
/tmp/.rdmd-1000/rdmd-app.d-D171C94ECB54675B9965F1B51CDCFF17/app() [0x4fc57d]
/tmp/.rdmd-1000/rdmd-app.d-D171C94ECB54675B9965F1B51CDCFF17/app() [0x411fc0]
...

Well, actually - in trying to troubleshoot I tracked down this file and added an import for core log, and a couple log infos around where the exception was, so the line 92 is this:

    m_remaining[0 .. arr.length] = arr;

which will not match exactly to original. Anyway, I put two loginfo's before and after grow:

        logInfo(text("before grow remaining len:", m_remaining.length, " vs arr.length: ", arr.length, ' ', m_remaining.length < arr.length ));

and the results:

 ./run-example.sh diet
/usr/local/bin/vibe: 21: /usr/local/bin/vibe: cannot create /dev/null: Permission denied
/usr/local/bin/vibe: 22: /usr/local/bin/vibe: cannot create /dev/null: Permission denied
Checking dependencies in '/home/dbdavidson/stage/vibe.d/examples/diet'
Compiling diet template 'diet.dt' (compat)...
Compiling diet template 'diet.dt' (compat)...
[7FD80FCFC0D8:00000000 INF] Listening for HTTP requests on :::8080
[7FD80FCFC0D8:00000000 WRN] Failed to listen on 0.0.0.0:8080
[7FD80FCFC0D8:00000000 INF] Running event loop...
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:64 vs arr.length: 2 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:64 vs arr.length: 2 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:62 vs arr.length: 12 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:62 vs arr.length: 12 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:64 vs arr.length: 20 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:64 vs arr.length: 20 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:64 vs arr.length: 22 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:64 vs arr.length: 22 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:64 vs arr.length: 24 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:64 vs arr.length: 24 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:64 vs arr.length: 71 true
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:64 vs arr.length: 71 true
[7FD80FCFC0D8:7FD80FCFC1D8 INF] before grow remaining len:0 vs arr.length: 0 false
[7FD80FCFC0D8:7FD80FCFC1D8 INF] after grow remaining len:0 vs arr.length: 0 false
...

So for some reason, it looks like grow did not do its thing when it hit 71?

Thanks
Dan

Re: running examples

On Thu, 21 Mar 2013 13:41:21 GMT, Daniel Davidson wrote:

Sorry for very basic question - but, I think I have vibe installed correctly (although I could not use dub because I had issues with libcurl on my ubuntu). I can, for example do:

$ ./run-example.sh json

and will see some json written. But when I run those that involve web stuff I don't think it is working (or I don't know what to look for). For example, if I run the 'diet' example, I see one Failed to listen on 0.0.0.0:8080, which I think is ok since it keeps going and prints Running event loop.... Not sure what to do then. I expected to enter "0.0.0.0:8080" in the browser and see something, but all I see is the error below.

(...)

Are you using the latest release or the git master version (git master works for me)? I remember that there was at least a similar bug that has been resolved for a while. If you are running the release version, trying with the git version is just

git clone https://github.com/rejectedsoftware/vibe.d
cd vibe.d
./install-linux.sh -i
./run_example.sh diet

Regarding the DUB/libcurl problems, did you use the precompiled binary, the Debian package, or compile from source? It usually just needs to have libcurl3 installed (libcurl3-gnutls should also work).

Re: running examples

On Thu, 21 Mar 2013 14:08:09 GMT, Sönke Ludwig wrote:

Are you using the latest release or the git master version (git master works for me)? I remember that there was at least a similar bug that has been resolved for a while. If you are running the release version, trying with the git version is just

git clone https://github.com/rejectedsoftware/vibe.d
cd vibe.d
./install-linux.sh -i
./run_example.sh diet

Regarding the DUB/libcurl problems, did you use the precompiled binary, the Debian package, or compile from source? It usually just needs to have libcurl3 installed (libcurl3-gnutls should also work).

This is great, thanks!

I think I had done the git clone a while back... I just downloaded the zip, did the install and it worked.
Regarding dub, I think I tried both the compile from source and precompiled (dub-0.9.11-linux-x86_64). But now, interestingly dub is doing better. Maybe dub just needed a cleaner vibe?

So, per the instructions I dub install vibelog --local, then cd vibelog and dub and I get:

Checking dependencies in '/home/dbdavidson/plusauri/dlang/dub/vibelog'
The following changes could be performed:
Install vibe-d ~master, projectLocal
Downloading vibe-d ~master...
Installing vibe-d ~master...
vibe-d has been installed with version ~master
You are up to date
Building configuration "application", build type debug
Running dmd (compile)...
Compiling diet template 'mail.new_comment.dt' (compat)...
Compiling diet template 'vibelog.postlist.dt' (compat)...
Compiling diet template 'vibelog.post.dt' (compat)...
Compiling diet template 'vibelog.admin.dt' (compat)...
Compiling diet template 'vibelog.editconfiglist.dt' (compat)...
Compiling diet template 'vibelog.editconfig.dt' (compat)...
Compiling diet template 'vibelog.edituserlist.dt' (compat)...
Compiling diet template 'vibelog.edituser.dt' (compat)...
Compiling diet template 'vibelog.editpostslist.dt' (compat)...
Compiling diet template 'vibelog.editpost.dt' (compat)...
Linking...
object.Exception@.dub/packages/vibe-d/source/vibe/core/drivers/libevent2.d(216): Failed to connect to host localhost on port 27017: 33
----------------
/tmp/dub/510258254/vibelog() [0x4aae72]
/tmp/dub/510258254/vibelog() [0x486a83]
/tmp/dub/510258254/vibelog() [0x4827f5]

A similar "Failed to connect..." issue was raised from goole and seems to have been fixed 7 days ago, but not sure if it is the same or what steps to incorporate a fix?

Re: running examples

On Thu, 21 Mar 2013 14:29:56 GMT, Daniel Davidson wrote:

On Thu, 21 Mar 2013 14:08:09 GMT, Sönke Ludwig wrote:

Are you using the latest release or the git master version (git master works for me)? I remember that there was at least a similar bug that has been resolved for a while. If you are running the release version, trying with the git version is just

git clone https://github.com/rejectedsoftware/vibe.d
cd vibe.d
./install-linux.sh -i
./run_example.sh diet

Regarding the DUB/libcurl problems, did you use the precompiled binary, the Debian package, or compile from source? It usually just needs to have libcurl3 installed (libcurl3-gnutls should also work).

This is great, thanks!

I think I had done the git clone a while back... I just downloaded the zip, did the install and it worked.
Regarding dub, I think I tried both the compile from source and precompiled (dub-0.9.11-linux-x86_64). But now, interestingly dub is doing better. Maybe dub just needed a cleaner vibe?

So, per the instructions I dub install vibelog --local, then cd vibelog and dub and I get:

Checking dependencies in '/home/dbdavidson/plusauri/dlang/dub/vibelog'
The following changes could be performed:
Install vibe-d ~master, projectLocal
Downloading vibe-d ~master...
Installing vibe-d ~master...
vibe-d has been installed with version ~master
You are up to date
Building configuration "application", build type debug
Running dmd (compile)...
Compiling diet template 'mail.new_comment.dt' (compat)...
Compiling diet template 'vibelog.postlist.dt' (compat)...
Compiling diet template 'vibelog.post.dt' (compat)...
Compiling diet template 'vibelog.admin.dt' (compat)...
Compiling diet template 'vibelog.editconfiglist.dt' (compat)...
Compiling diet template 'vibelog.editconfig.dt' (compat)...
Compiling diet template 'vibelog.edituserlist.dt' (compat)...
Compiling diet template 'vibelog.edituser.dt' (compat)...
Compiling diet template 'vibelog.editpostslist.dt' (compat)...
Compiling diet template 'vibelog.editpost.dt' (compat)...
Linking...
object.Exception@.dub/packages/vibe-d/source/vibe/core/drivers/libevent2.d(216): Failed to connect to host localhost on port 27017: 33
----------------
/tmp/dub/510258254/vibelog() [0x4aae72]
/tmp/dub/510258254/vibelog() [0x486a83]
/tmp/dub/510258254/vibelog() [0x4827f5]

A similar "Failed to connect..." issue was raised from goole and seems to have been fixed 7 days ago, but not sure if it is the same or what steps to incorporate a fix?

The connection failure means that there is no MongoDB service running (uses port 27017 by default). I'd use their official APT repository for that: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/.