Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

Re: Does Eval Module work Now?

thread epoll_wait
(5 lines)
Jan 11, 2011
Agentzh
Agentzh
On Tue, Jan 11, 2011 at 4:31 AM, Sirsiwal, Umesh
<usirs### @verivue.com> wrote:
 Thanks agentzh,
 I tried rewrite_by_lua with the following simple Lua configuration:

 local res = ngx.location.capture("/memc?key=" .. memc_key )
 print("copass: res " .. res.status .. ' body ' .. res.body)

 if res.status == 404 then
        print("copas: capture /memc_set")
        res = ngx.location.capture("/memc_set?key=" .. memc_key)
        print("copss: status " .. res.status);
 end


I've just tested this config snippet in my slackware linux x86_64 box
(nginx 0.8.54/0.9.3 + ngx_lua git HEAD) and it works fine. Here's the
config that I'm using:

    location /memc {
        set $memc_cmd get;
        set $memc_key $arg_key;
        memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
    }

    location /memc_set {
        #set $memc_cmd set;
        #set $memc_key $arg_key;
        #memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
        echo OK;
    }

    location /lua {
        rewrite_by_lua '
            local memc_key = "hello"
            local res = ngx.location.capture("/memc?key=" .. memc_key )
            print("copass: res " .. res.status .. " body " .. res.body)

            if res.status == 404 then
                   print("copas: capture /memc_set")
                   res = ngx.location.capture("/memc_set?key=" .. memc_key)
                   print("copss: status " .. res.status);
            end
        ';
        content_by_lua 'return';
    }

And here's the debugging outputs in my error.log:

2011/01/11 15:18:32 [info] 10985#0: *1 key: "hello" was not found by
memcached while reading response header from upstream, client:
127.0.0.1, server: localhost, request: "GET /lua HTTP/1.1",
subrequest: "/memc", upstream: "memcached://127.0.0.1:11211", host:
"localhost"
2011/01/11 15:18:32 [debug] 10985#0: *1 http wake parent request: "/lua?"
2011/01/11 15:18:32 [debug] 10985#0: *1 http posted request: "/lua?"
2011/01/11 15:18:32 [notice] 10985#0: *1 lua print: copass: res 404 body
<html>
 while sending to client, client: 127.0.0.1, server: localhost,
request: "GET /lua HTTP/1.1", host: "localhost"
2011/01/11 15:18:32 [notice] 10985#0: *1 lua print: copas: capture
/memc_set while sending to client, client: 127.0.0.1, server:
localhost, request: "GET /lua HTTP/1.1", host: "localhost"
2011/01/11 15:18:32 [debug] 10985#0: *1 http wake parent request: "/lua?"
2011/01/11 15:18:32 [debug] 10985#0: *1 http posted request: "/lua?"
2011/01/11 15:18:32 [notice] 10985#0: *1 lua print: copss: status 200,
client: 127.0.0.1, server: localhost, request: "GET /lua HTTP/1.1",
host: "localhost"



 I see that the subrequest was correctly issued to the /memc location.
However /memc_set location subrequest was never issued.


Can you try out my testing config given above on your side? And paste
your complete nginx.conf and tell me which verison of nginx and
ngx_lua and what kind of operating system are you using?

Cheers,
-agentzh


Reply
Tags: key printport locationlinux x86reading responseslackware linuxhost localhostresponse headerluasnippetverivuememcachedlinux
Messages in this thread
reply Does Eval Module work Now?
(26 lines) Dec 30, 2010 14:56
reply Re: Does Eval Module work Now?
(20 lines) Dec 30, 2010 21:16
reply RE: Does Eval Module work Now?
(9 lines) Dec 31, 2010 09:44
reply Re: Does Eval Module work Now?
(25 lines) Jan 1, 2011 01:14
reply RE: Does Eval Module work Now?
(12 lines) Jan 1, 2011 10:55
reply Re: Does Eval Module work Now?
(26 lines) Jan 3, 2011 21:25
reply Re: Does Eval Module work Now?
(18 lines) Jan 5, 2011 22:53
reply RE: Does Eval Module work Now?
(49 lines) Jan 10, 2011 14:32
Re: Does Eval Module work Now?
reply Re: Does Eval Module work Now?
(21 lines) Jan 11, 2011 23:05
reply RE: Does Eval Module work Now?
(6 lines) Jan 12, 2011 08:29
db.eval in map-reduce does not work, but works on normal shell
November 16, 2010 04:53:33 PM
Hi, I wrote a map-reduce job for processing and converting some part of the input record to MD5 hash. Now when I do > db.eval("return MD5(\"Harshad\")"); 8fa9433ede03810acd2936a7c620b0f6 It works perfectly. But if I include it in a reduce…
Eval UDF passing parameters
December 7, 2010 01:44:59 PM
Hi, This might be a dumb question. Is it possible to pass anything other than the input tuple to a UDF Eval function? Basically in my UDF, I need to do some user info lookup. So the input will be: (userid,f1,f2) with this UDF, I want to convert…
mongo shell and the --eval
September 6, 2010 12:01:35 PM
Hi guys.. Can anybody point me at the documentation for the mongo shell eval command? I'm trying to execute simple commands such as: $ mongo dbname --eval "db.collectionname.find()" This results in an error dbname.collectionname is not…
Created: (PIG-1621) What does EVAL keyword do?
September 17, 2010 12:20:21 PM
What does EVAL keyword do?
Why we need to block all options in MongoDB when perform eval ?
August 17, 2010 11:11:24 AM
Why we need to block all operations in MongoDB when perform eval operation? Thanks.
Updated: (FELIX-1522) Add an eval command / keyword
June 21, 2010 10:23:23 AM
[ https://issues.apache.org/jira/browse/FELIX-1522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Richard S. Hall updated FELIX-1522:
Updated: (FELIX-1522) Add an eval command / keyword
June 21, 2010 07:26:23 AM
[ https://issues.apache.org/jira/browse/FELIX-1522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Derek Baum updated FELIX-1522:
Updated: (PIG-656) Use of eval or any other keyword in the package hierarchy of a UDF causes parse e
July 23, 2010 12:25:50 PM
[ https://issues.apache.org/jira/browse/PIG-656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Aniket Mokashi updated PIG-656:
Commented: (PIG-656) Use of eval or any other keyword in the package hierarchy of a UDF causes parse
July 26, 2010 11:36:50 AM
[ https://issues.apache.org/jira/browse/PIG-656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892353#action_12892353 ] Aniket Mokashi commented on PIG-656:
DO NOT REPLY module mod_authz_dbd - doesn't work when multiple groups are returned
July 19, 2010 07:12:10 PM
https://issues.apache.org/bugzilla/show_bug.cgi?id=46421 --- Comment #4 from Nick Kew <nick@webthing.com> 2010-07-19 20:12:08 EDT --- This is confusing: the mysql driver returns memory from what appears to be an array returned by mysql, so…
Work-around for the scroll issue doesn't seems to work propertly (also)
November 23, 2010 10:05:55 AM
Hi, since scrolling is still broken (in all latest versions, 0.13 included) https://github.com/elasticsearch/elasticsearch/issues#issue/136 'from' parameter work-around seems to be recommend way to go …
Created: (SLING-1651) Integrate RunMode module into new Settings Module
August 13, 2010 05:16:08 AM
Integrate RunMode module into new Settings Module
Created: (GERONIMO-5667) Tomcat utils module needs to load MBean classes from catalina module
October 28, 2010 01:40:33 AM
Tomcat utils module needs to load MBean classes from catalina module
Updated: (GERONIMO-5541) web module cannot see the PU defined in ejb module when deploying a EAR
August 19, 2010 06:36:43 AM
[ https://issues.apache.org/jira/browse/GERONIMO-5541?page=com.atlassian .jira.plugin.system.issuetabpanels:all-tabpanel ] Forrest Xia updated GERONIMO-5541:
Created: (GERONIMO-5541) web module cannot see the PU defined in ejb module when deploying a EAR
August 19, 2010 06:37:19 AM
web module cannot see the PU defined in ejb module when deploying a EAR
Closed: (DAYTRADER-1) [Daytrader] ejb module should not depend on wsappclient module
November 24, 2010 12:29:00 AM
[ https://issues.apache.org/jira/browse/DAYTRADER-1?page=com.atlassian.j ira.plugin.system.issuetabpanels:all-tabpanel ] Forrest Xia closed DAYTRADER-1.
svn commit: r949463 - in /httpd/mod_mbox/trunk: CHANGES module-2.0/mod_mbox.c module-2.0/mod_mbox.h
May 29, 2010 10:15:04 PM
Author: jerenkrantz Date: Sun May 30 03:15:04 2010 New Revision: 949463 URL: http://svn.apache.org/viewvc?rev=949463&view=rev Log: Fix up non-printable character support with Firefox and Google Chrome over AJAX interfaces. For a test case,…
Web example does not work
June 1, 2010 12:55:09 PM
http://ant.apache.org/manual/Tasks/jar.html <jar destfile="build/main/checksites.jar"> <fileset dir="build/main/classes"/> <zipfileset includes="**/*.class"> <fileset dir="lib/main" includes="**/*.jar"/> …
how can this work?
September 1, 2010 02:45:39 PM
in poll/unix.poll.c (which is also compiled for win32) we have: /* Poll method pollcb. * This is probably usable only for WIN32 having WSAPoll */ static apr_status_t impl_pollcb_create(apr_pollcb_t *pollcb, …
Start work on 2.0?
September 12, 2010 01:15:26 PM
I would like to begin working toward a version 2.0 of [pool]. I would also like to declare the 1.x codebase as officially "bugfix only." If others are OK with this and there is sufficient interest in working toward a pool 2.0, I will cut a 1.x…
Nginx has ssl module, but thinks it doesn't
December 13, 2010
I'm adding an SSL domain to a host. When I try to restart Nginx, it protests: Restarting nginx: [emerg]: the "ssl" parameter requires…
Is there any way to use arrays in a puppet module (not in template)?
May 10, 2010
I want to use puppet to manage a hadoop cluster. On the machines we have several directories which must be created and set permissions. But i'm…
Securing channels with nginx and http push module
November 23, 2010
I was able to setup nginx as a message server for building a real-time javascript application with Dojo. For the setup I used the nginx…
Problem with installing sqlite3 module for python 2.6 on an ubuntu system
March 20, 2010
I need to run the sqlite3 module on python 2.6 in an ubuntu system. How do I install this module for Python 2.6? Somehow I don't have this module,…
How do I get PHP to work with UserDir
August 19, 2010
I've got a fresh CentOS 5.5 box and have installed Webmin+VirtualMin 3.79. I've enabled UserDir in apache and the sites are visible via…
Sudo gem install pg won't work
December 30, 2010
I'm trying to get Rails to work with PostgreSQL. Apparently one thing I need to do along the way is sudo gem install pg . When I do that, I get…
How to make this sub-sub-query work?
December 29, 2010
I am trying to do this in one query. I asked a similar question a few days ago but my personal requirements have changed. I have a game type website…
Lighttpd stops to work everywhile
December 6, 2010
I've an issue with my Lighttpd. It stops to work every while, and I've to restart it. In the log files, I cannot read anything about this. How can I…
How does MySQL Auto Increment work?
December 30, 2010
I was just creating a new table using MySQL Query Browser, and noticed there's a tick under Auto Increment Column. How does that work? When adding…
Getting the following code to work in both Chrome and Safari
December 20, 2010
Hey guys Can't seem to figure out why this works in Safari but not in chrome. Any help would be much appreciated. //Create or use existing DB var db…
How does netezza work? how does it compare to Hadoop?
December 29, 2010
want to understand if Netezza/Hadoop is the right choice for the below purposes: pull feed files from several online sources of considerable size at…
What is the state of the art for getting wordpress to work with nginx on ubuntu?
December 30, 2010
I've seen a number of different ways of getting it done and a few plugins and was wondering if there was a best way.
SSL certificate doesn't work. Cannot connect to https://mydomain.com
November 11, 2010
I've setup a SSL certificate on lighttpd, on Ubuntu 10. The issue is that when I try to access to https://mydomain.com I get "impossible to…
How JAVA video can work, within a friendly installation procedure ?
December 29, 2010
How can you capture Video using Java ? You have to use JMF ? In my research Audio part is solved, someone would not require Audio with JMF (in case…
Lighttpd start/stop/restart script doesn’t work
March 23, 2010
Hi, I want to restart lighttpd using */lighttpd restart command, but nothing happens, no message, error, just a new cli line waiting for command.…
JConsole tomcat connectivity does not work on Windows Server 2008 R2
December 23, 2010
I am having a problem connecting to Tomcat 6 running as a service on Windows Server 2008 R2. Here are the details of my setup. 32 Bit JDK 1.6._23 64…
Hadoop installation on VMware work station with multiple virtual machines
August 24, 2010
Hi This is what I want to do : I want to learn about hadoop and run some hands on distributed computing by some programming I have a windows box…
Need ability to set configuration options using single method which will work across multiple server configurations.
December 29, 2010
I'm trying to set post_max_size and upload_max_filesize in a specific directory for a web application I'm building. I've tried the following in a…