[hxfcgi]neko - works, cpp - not

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[hxfcgi]neko - works, cpp - not

alexander.konotop
Hello :-)

I use hxfcgi quite a long time but I've always used only neko target and
"nekotools boot" after compiling because I need to communicate with
PostgreSQL db and nPostgres is neko library but not cpp. So it worked
for me for a long time and I didn't see this problem.

Now I need to rewrite one extra-heavy-loaded php file to haxe+cpp+fcgi
and one problem has encountered while trying to work with it: lighttpd
webserver says that spawning fcgi failed while starting (it works with
neko but not with cpp). I've tried to run neko and cpp versions just
from linux console without webserver - and their output is identical -
so I can't understand what's wrong. Then I tried to use spawn-fcgi - it
works with neko, prints me pid, but with cpp it says that child exited
with code 0 (0 is just normal exit - so I'm confused even more :-)).
Usually (with neko) I don't use spawn-fcgi - lighttpd executes it
itself.

I think that it's related somehow to nekoapi.ndll and hxfcgi.ndll libs.
I tried putting these ndlls in the same folder where my fcgi binaries
are situated - actually if I don't do it - neko fcgi will not work at
all but cpp binary will work - looks like it just doesn't need it.
anyway cpp cant't start through fcgi. Also I have ndlls lying
at /usr/lib/neko - so they have to be found anyway. I even tried to
rename *.ndll to *.so without any result.

Here:
http://haxe.org/com/libs/hxfcgi
It's written:
=========================
* If you deploy an application compiled with the haXe cpp target to
your webserver you need the hxfcgi.ndll to be loadable from the FastCGI
process / loadable from the web server process.
* If you deploy an application compiled with the neko target to your
webserver you need the hxfcgi.ndll AND the nekoapi.ndll to be
loadable for the nekoVM.
=========================

So: maybe cpp binary is somehow not linked to ndll's? Or I'm doing smth
wrong? And is cpp really faster than neko - maybe not (anyway it's
interesting to get both neko and cpp working :-))?

Best regards and good night (americans - good morning :-))
Alexander

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

KaalH!
Hello,

I'm running cpp hxfcgi on lighttpd + spawn-fcgi on production.

hxfcgi.ndll is in the binary folder, and .dso files are in the LIBRARY_PATH (/usr/lib)

My run script looks like :

spawn-fcgi -n -M 0600 -U www-data -s /tmp/socket -d /my-binary-folder index.fcgi

hope that helps
kaalh

Le 3 nov. 2011 à 21:08, Alexander Konotop a écrit :

> Hello :-)
>
> I use hxfcgi quite a long time but I've always used only neko target and
> "nekotools boot" after compiling because I need to communicate with
> PostgreSQL db and nPostgres is neko library but not cpp. So it worked
> for me for a long time and I didn't see this problem.
>
> Now I need to rewrite one extra-heavy-loaded php file to haxe+cpp+fcgi
> and one problem has encountered while trying to work with it: lighttpd
> webserver says that spawning fcgi failed while starting (it works with
> neko but not with cpp). I've tried to run neko and cpp versions just
> from linux console without webserver - and their output is identical -
> so I can't understand what's wrong. Then I tried to use spawn-fcgi - it
> works with neko, prints me pid, but with cpp it says that child exited
> with code 0 (0 is just normal exit - so I'm confused even more :-)).
> Usually (with neko) I don't use spawn-fcgi - lighttpd executes it
> itself.
>
> I think that it's related somehow to nekoapi.ndll and hxfcgi.ndll libs.
> I tried putting these ndlls in the same folder where my fcgi binaries
> are situated - actually if I don't do it - neko fcgi will not work at
> all but cpp binary will work - looks like it just doesn't need it.
> anyway cpp cant't start through fcgi. Also I have ndlls lying
> at /usr/lib/neko - so they have to be found anyway. I even tried to
> rename *.ndll to *.so without any result.
>
> Here:
> http://haxe.org/com/libs/hxfcgi
> It's written:
> =========================
> * If you deploy an application compiled with the haXe cpp target to
> your webserver you need the hxfcgi.ndll to be loadable from the FastCGI
> process / loadable from the web server process.
> * If you deploy an application compiled with the neko target to your
> webserver you need the hxfcgi.ndll AND the nekoapi.ndll to be
> loadable for the nekoVM.
> =========================
>
> So: maybe cpp binary is somehow not linked to ndll's? Or I'm doing smth
> wrong? And is cpp really faster than neko - maybe not (anyway it's
> interesting to get both neko and cpp working :-))?
>
> Best regards and good night (americans - good morning :-))
> Alexander
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

alexander.konotop
В Fri, 4 Nov 2011 08:52:34 +0100
KaalH! <[hidden email]> пишет:

> Hello,
>
> I'm running cpp hxfcgi on lighttpd + spawn-fcgi on production.
>
> hxfcgi.ndll is in the binary folder, and .dso files are in the
> LIBRARY_PATH (/usr/lib)
>
> My run script looks like :
>
> spawn-fcgi -n -M 0600 -U www-data -s /tmp/socket -d /my-binary-folder
> index.fcgi
>
> hope that helps
> kaalh
>
> Le 3 nov. 2011 à 21:08, Alexander Konotop a écrit :
>
> > Hello :-)
> >
> > I use hxfcgi quite a long time but I've always used only neko
> > target and "nekotools boot" after compiling because I need to
> > communicate with PostgreSQL db and nPostgres is neko library but
> > not cpp. So it worked for me for a long time and I didn't see this
> > problem.
> >
> > Now I need to rewrite one extra-heavy-loaded php file to
> > haxe+cpp+fcgi and one problem has encountered while trying to work
> > with it: lighttpd webserver says that spawning fcgi failed while
> > starting (it works with neko but not with cpp). I've tried to run
> > neko and cpp versions just from linux console without webserver -
> > and their output is identical - so I can't understand what's wrong.
> > Then I tried to use spawn-fcgi - it works with neko, prints me pid,
> > but with cpp it says that child exited with code 0 (0 is just
> > normal exit - so I'm confused even more :-)). Usually (with neko) I
> > don't use spawn-fcgi - lighttpd executes it itself.
> >
> > I think that it's related somehow to nekoapi.ndll and hxfcgi.ndll
> > libs. I tried putting these ndlls in the same folder where my fcgi
> > binaries are situated - actually if I don't do it - neko fcgi will
> > not work at all but cpp binary will work - looks like it just
> > doesn't need it. anyway cpp cant't start through fcgi. Also I have
> > ndlls lying at /usr/lib/neko - so they have to be found anyway. I
> > even tried to rename *.ndll to *.so without any result.
> >
> > Here:
> > http://haxe.org/com/libs/hxfcgi
> > It's written:
> > =========================
> > * If you deploy an application compiled with the haXe cpp target to
> > your webserver you need the hxfcgi.ndll to be loadable from the
> > FastCGI process / loadable from the web server process.
> > * If you deploy an application compiled with the neko target to your
> > webserver you need the hxfcgi.ndll AND the nekoapi.ndll to be
> > loadable for the nekoVM.
> > =========================
> >
> > So: maybe cpp binary is somehow not linked to ndll's? Or I'm doing
> > smth wrong? And is cpp really faster than neko - maybe not (anyway
> > it's interesting to get both neko and cpp working :-))?
> >
> > Best regards and good night (americans - good morning :-))
> > Alexander
> >
> > --
> > haXe - an open source web programming language
> > http://haxe.org
>
>

Neko writes nothing (looks like it works in non-daemon mode with these
spawn-fcgi options).
Cpp unfortunately writes:
Error : Could not load module std@get_env__1
I tried to put all neko ndlls to this folder - std.ndll and others -
without any success :-(

And what dso files are You talking about? What is it? :-)

Best regards
Alexander

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

KaalH!

Le 4 nov. 2011 à 11:00, Alexander Konotop a écrit :

> В Fri, 4 Nov 2011 08:52:34 +0100
> KaalH! <[hidden email]> пишет:
>
>> Hello,
>>
>> I'm running cpp hxfcgi on lighttpd + spawn-fcgi on production.
>>
>> hxfcgi.ndll is in the binary folder, and .dso files are in the
>> LIBRARY_PATH (/usr/lib)
>>
>> My run script looks like :
>>
>> spawn-fcgi -n -M 0600 -U www-data -s /tmp/socket -d /my-binary-folder
>> index.fcgi
>>
>> hope that helps
>> kaalh
>>
>> Le 3 nov. 2011 à 21:08, Alexander Konotop a écrit :
>>
>>> Hello :-)
>>>
>>> I use hxfcgi quite a long time but I've always used only neko
>>> target and "nekotools boot" after compiling because I need to
>>> communicate with PostgreSQL db and nPostgres is neko library but
>>> not cpp. So it worked for me for a long time and I didn't see this
>>> problem.
>>>
>>> Now I need to rewrite one extra-heavy-loaded php file to
>>> haxe+cpp+fcgi and one problem has encountered while trying to work
>>> with it: lighttpd webserver says that spawning fcgi failed while
>>> starting (it works with neko but not with cpp). I've tried to run
>>> neko and cpp versions just from linux console without webserver -
>>> and their output is identical - so I can't understand what's wrong.
>>> Then I tried to use spawn-fcgi - it works with neko, prints me pid,
>>> but with cpp it says that child exited with code 0 (0 is just
>>> normal exit - so I'm confused even more :-)). Usually (with neko) I
>>> don't use spawn-fcgi - lighttpd executes it itself.
>>>
>>> I think that it's related somehow to nekoapi.ndll and hxfcgi.ndll
>>> libs. I tried putting these ndlls in the same folder where my fcgi
>>> binaries are situated - actually if I don't do it - neko fcgi will
>>> not work at all but cpp binary will work - looks like it just
>>> doesn't need it. anyway cpp cant't start through fcgi. Also I have
>>> ndlls lying at /usr/lib/neko - so they have to be found anyway. I
>>> even tried to rename *.ndll to *.so without any result.
>>>
>>> Here:
>>> http://haxe.org/com/libs/hxfcgi
>>> It's written:
>>> =========================
>>> * If you deploy an application compiled with the haXe cpp target to
>>> your webserver you need the hxfcgi.ndll to be loadable from the
>>> FastCGI process / loadable from the web server process.
>>> * If you deploy an application compiled with the neko target to your
>>> webserver you need the hxfcgi.ndll AND the nekoapi.ndll to be
>>> loadable for the nekoVM.
>>> =========================
>>>
>>> So: maybe cpp binary is somehow not linked to ndll's? Or I'm doing
>>> smth wrong? And is cpp really faster than neko - maybe not (anyway
>>> it's interesting to get both neko and cpp working :-))?
>>>
>>> Best regards and good night (americans - good morning :-))
>>> Alexander
>>>
>>> --
>>> haXe - an open source web programming language
>>> http://haxe.org
>>
>>
>
> Neko writes nothing (looks like it works in non-daemon mode with these
> spawn-fcgi options).
> Cpp unfortunately writes:
> Error : Could not load module std@get_env__1
> I tried to put all neko ndlls to this folder - std.ndll and others -
> without any success :-(
>
> And what dso files are You talking about? What is it? :-)

you can find them in the hxcpp bin folder

>
> Best regards
> Alexander
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

alexander.konotop
Doesn't work :-(
$ sudo spawn-fcgi -n -M 0666 -U www-data -G www-data -s /tmp/socket_cpp -d /var/www/advert/fcgi/ viewshandler_cpp.fcgi
> Error : Could not load module std@get_env__1
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

KaalH!

Le 8 nov. 2011 à 09:56, alexander.konotop a écrit :

> Doesn't work :-(
> $ sudo spawn-fcgi -n -M 0666 -U www-data -G www-data -s /tmp/socket_cpp -d
> /var/www/advert/fcgi/ viewshandler_cpp.fcgi
>> Error : Could not load module std@get_env__1
>

seems that *.dso files are missing.

if hxcpp is not installed on your server, you can try to copy dso files to a folder and add this folder to your LD_LIBRARY_PATH

>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/hxfcgi-neko-works-cpp-not-tp6960411p6973563.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

alexander.konotop
В Tue, 8 Nov 2011 21:08:45 +0100
KaalH! <[hidden email]> пишет:

>
> Le 8 nov. 2011 à 09:56, alexander.konotop a écrit :
>
> > Doesn't work :-(
> > $ sudo spawn-fcgi -n -M 0666 -U www-data -G www-data
> > -s /tmp/socket_cpp -d /var/www/advert/fcgi/ viewshandler_cpp.fcgi
> >> Error : Could not load module std@get_env__1
> >
>
> seems that *.dso files are missing.
>
> if hxcpp is not installed on your server, you can try to copy dso
> files to a folder and add this folder to your LD_LIBRARY_PATH
>
> >
> > --
> > View this message in context:
> > http://haxe.1354130.n2.nabble.com/hxfcgi-neko-works-cpp-not-tp6960411p6973563.html
> > Sent from the Haxe mailing list archive at Nabble.com.
> >
> > --
> > haXe - an open source web programming language
> > http://haxe.org
>
>

COOOOOOOL! I've put dso's to /usr/lib and now it works! I'll think
about how to do it cleaner (for example put them to /usr/lib/neko where
my ndlls are put).

Thank's a lot!

BTW as a neko counterpart cpp now has only one disadvantage
- lack of DB libraries (mysql, etc.). Or it has such libraries? I saw a
haxeToNeko and nekoToHaxe methods in cpp.Lib class - so as I
understand I can just use ndlls in cpp? And this means that I can use
such libs as Mysql or nPostgres in cpp without any fundamental
modifications and without writing them from scratch?

P.S. I have my lighttpd config which doesn't use swapn-fcgi separately.
I think it may be good info to put into wiki at
http://haxe.org/com/libs/hxfcgi. Maybe You'll want to put it there.
Here it is:
------------------
#Lighttpd 1.4.29
$HTTP["host"] == "clickburner.localhost" {
  server.document-root = "/var/www/advert/"
  fastcgi.server += ( "/fcgi/viewshandler_cpp.fcgi" =>
    ((
      "bin-path" => "/var/www/advert/fcgi/viewshandler_cpp.fcgi",
      "socket" => "/tmp/hxfcgi-cb-viewshandler.socket",
      "kill-signal" => 10,     # this is because programs linked
against libfcgi need USR1 kill-signal
      "min-procs" => 1,
      "max-procs" => 2        # as You wish
    ))
  )

}
------------------
Also there's a lack of info about dso files on that page.

Best regards
Alexander

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

KaalH!

Le 9 nov. 2011 à 12:38, Alexander Konotop a écrit :

> В Tue, 8 Nov 2011 21:08:45 +0100
> KaalH! <[hidden email]> пишет:
>
>>
>> Le 8 nov. 2011 à 09:56, alexander.konotop a écrit :
>>
>>> Doesn't work :-(
>>> $ sudo spawn-fcgi -n -M 0666 -U www-data -G www-data
>>> -s /tmp/socket_cpp -d /var/www/advert/fcgi/ viewshandler_cpp.fcgi
>>>> Error : Could not load module std@get_env__1
>>>
>>
>> seems that *.dso files are missing.
>>
>> if hxcpp is not installed on your server, you can try to copy dso
>> files to a folder and add this folder to your LD_LIBRARY_PATH
>>
>>>
>>> --
>>> View this message in context:
>>> http://haxe.1354130.n2.nabble.com/hxfcgi-neko-works-cpp-not-tp6960411p6973563.html
>>> Sent from the Haxe mailing list archive at Nabble.com.
>>>
>>> --
>>> haXe - an open source web programming language
>>> http://haxe.org
>>
>>
>
> COOOOOOOL! I've put dso's to /usr/lib and now it works! I'll think
> about how to do it cleaner (for example put them to /usr/lib/neko where
> my ndlls are put).
>
> Thank's a lot!
>
> BTW as a neko counterpart cpp now has only one disadvantage
> - lack of DB libraries (mysql, etc.). Or it has such libraries? I saw a
> haxeToNeko and nekoToHaxe methods in cpp.Lib class - so as I
> understand I can just use ndlls in cpp? And this means that I can use
> such libs as Mysql or nPostgres in cpp without any fundamental
> modifications and without writing them from scratch?


haxeToNeko & nekoToHaxe are for converting strings.

yes, db libs are missing, you have to write them if needed.

>
> P.S. I have my lighttpd config which doesn't use swapn-fcgi separately.
> I think it may be good info to put into wiki at
> http://haxe.org/com/libs/hxfcgi. Maybe You'll want to put it there.
> Here it is:
> ------------------
> #Lighttpd 1.4.29
> $HTTP["host"] == "clickburner.localhost" {
>  server.document-root = "/var/www/advert/"
>  fastcgi.server += ( "/fcgi/viewshandler_cpp.fcgi" =>
>    ((
>      "bin-path" => "/var/www/advert/fcgi/viewshandler_cpp.fcgi",
>      "socket" => "/tmp/hxfcgi-cb-viewshandler.socket",
>      "kill-signal" => 10,     # this is because programs linked
> against libfcgi need USR1 kill-signal
>      "min-procs" => 1,
>      "max-procs" => 2        # as You wish
>    ))
>  )
>
> }
> ------------------
> Also there's a lack of info about dso files on that page.

they are needed only if hxcpp is not installed via haxelib

>
> Best regards
> Alexander
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [hxfcgi]neko - works, cpp - not

alexander.konotop
В Fri, 11 Nov 2011 21:04:59 +0100
KaalH! <[hidden email]> пишет:

>
> Le 9 nov. 2011 à 12:38, Alexander Konotop a écrit :
>
> > В Tue, 8 Nov 2011 21:08:45 +0100
> > KaalH! <[hidden email]> пишет:
> >
> >>
> >> Le 8 nov. 2011 à 09:56, alexander.konotop a écrit :
> >>
> >>> Doesn't work :-(
> >>> $ sudo spawn-fcgi -n -M 0666 -U www-data -G www-data
> >>> -s /tmp/socket_cpp -d /var/www/advert/fcgi/ viewshandler_cpp.fcgi
> >>>> Error : Could not load module std@get_env__1
> >>>
> >>
> >> seems that *.dso files are missing.
> >>
> >> if hxcpp is not installed on your server, you can try to copy dso
> >> files to a folder and add this folder to your LD_LIBRARY_PATH
> >>
> >>>
> >>> --
> >>> View this message in context:
> >>> http://haxe.1354130.n2.nabble.com/hxfcgi-neko-works-cpp-not-tp6960411p6973563.html
> >>> Sent from the Haxe mailing list archive at Nabble.com.
> >>>
> >>> --
> >>> haXe - an open source web programming language
> >>> http://haxe.org
> >>
> >>
> >
> > COOOOOOOL! I've put dso's to /usr/lib and now it works! I'll think
> > about how to do it cleaner (for example put them to /usr/lib/neko
> > where my ndlls are put).
> >
> > Thank's a lot!
> >
> > BTW as a neko counterpart cpp now has only one disadvantage
> > - lack of DB libraries (mysql, etc.). Or it has such libraries? I
> > saw a haxeToNeko and nekoToHaxe methods in cpp.Lib class - so as I
> > understand I can just use ndlls in cpp? And this means that I can
> > use such libs as Mysql or nPostgres in cpp without any fundamental
> > modifications and without writing them from scratch?
>
>
> haxeToNeko & nekoToHaxe are for converting strings.
>
> yes, db libs are missing, you have to write them if needed.
>
> >
> > P.S. I have my lighttpd config which doesn't use swapn-fcgi
> > separately. I think it may be good info to put into wiki at
> > http://haxe.org/com/libs/hxfcgi. Maybe You'll want to put it there.
> > Here it is:
> > ------------------
> > #Lighttpd 1.4.29
> > $HTTP["host"] == "clickburner.localhost" {
> >  server.document-root = "/var/www/advert/"
> >  fastcgi.server += ( "/fcgi/viewshandler_cpp.fcgi" =>
> >    ((
> >      "bin-path" => "/var/www/advert/fcgi/viewshandler_cpp.fcgi",
> >      "socket" => "/tmp/hxfcgi-cb-viewshandler.socket",
> >      "kill-signal" => 10,     # this is because programs linked
> > against libfcgi need USR1 kill-signal
> >      "min-procs" => 1,
> >      "max-procs" => 2        # as You wish
> >    ))
> >  )
> >
> > }
> > ------------------
> > Also there's a lack of info about dso files on that page.
>
> they are needed only if hxcpp is not installed via haxelib
>
> >
> > Best regards
> > Alexander
> >
> > --
> > haXe - an open source web programming language
> > http://haxe.org
>
>

As I understand I needed it because I use haxelib and haxe as user
"Alexander" but lighttpd operates as user "www-data", am I right?

Also it means "sudo spawn-fcgi....." didn't work because I used "sudo"
to launch it as "root" instead of launching as "Alexander"?

Best regards
Alexander

--
haXe - an open source web programming language
http://haxe.org