CGI debug - port

Help
r_olivieri
2007-12-18
2013-05-20
  • r_olivieri
    r_olivieri
    2007-12-18

    Hello,

    I've seen a few posts related or similar to the following problem but I haven't seen a definite answer or solution. I am wondering if this could be a bug. I used EPIC 0.6.17 (testing) and 0.5.41 (stable) and got the same results (it made no difference for this particular problem). My environment is: Eclipse 3.3.1.1, Linux Red Hat Enterprise Linux Client release 5 (Tikanga), kernel -  2.6.18-8.1.4.el5

    I am trying to DEBUG and RUN a perl CGI file using EPIC. I used the lauch configuration panel to specify the "Web server" parameters.

    1) Regardless of the value I specify for the HTML startup file, EPIC always looks for index.html (in RUN or DEBUG mode). I have double checked that the file I specified for the HTML startup file does exist and that its permissions are correct. Regardless of this, EPIC always tries to find index.html. I then get an error message in the browser since I don't have an index.html page. After this, I can point (manually) the browser to the page I want to use as the startup file and from there it works OK. I also do get some strange errors in the log but that does not seem to cause a problem... at least not yet:

    Error: 408 Request Time-out: Read timed out

    2) When using DEBUG mode, I always get the following error message: "Could not connect to debug port". Then right after this, the "Web server" process dies. This happens always, even after rebooting the machine. It does not matter if it is the first time I am trying to debug a CGI script or if I restart eclipse or if I reboot the machine. I always get this message when trying to debug a CGI script with EPIC (and the process always dies after the message).

    Does anyone have experienced this problem? Any ideas on what could be causing this? Thanks.

     
    • Jan Ploski
      Jan Ploski
      2007-12-18

      Regarding 1) - please provide the exact steps to reproduce this using a simple test CGI script. It works as expected for me.

      Regarding 2) - EPIC listens for connections from the debugger at ports 5000-5004. If your firewall blocks these ports, it could be one reason. Another reason can be that EPIC binds to a different IP address than the debugger tries to connect to. To find out more about what is going on, use netstat or a packet sniffer like tcpdump. Does debugging non-CGI scripts work for you?

       
      • r_olivieri
        r_olivieri
        2007-12-19

        Hi,

        Thanks for getting back to me. These are the steps for #1:

        1) Start Eclipse
        2) Create a Perl project in the workspace (at the moment it only has one simple CGI script (hello world script) which I exported to the /var/www/cgi-bin folfer). You actually don't need a CGI script to reproduce this problem since it is just related to the HTML startup file. However, this is my simple cgi script:

        #!/usr/bin/perl
        print "Content-type: text/html\n\n";
        print "Hello, World.";

        3) Create a simple HTML page (hello world page). I placed this file in /var/www/html:

        <html>
        <body>
        Hello there!
        <body>
        <html>

        4) I made sure both files were accessible via the Apache server I have on my box.
        5) Provide the launch configuration for "Perl CGI". In my case, I am using the following values for web server:
          HTML Root Dir: /var/www/html
          HTML startup file: /var/www/html/test.html
          CGI root dir: /var/www/cgi-bin
        6) Run the "launch configuration" for Perl CGI. This is the output I am getting:

        Found default config file
        Server started on 5003
        LOG: 5 5003-server: main.: starting handler: cgi
        LOG: 5 5003-server: main.: starting handler: file
        LOG: 4 5003-server: 127.0.0.1: new connection
        LOG: 3 5003-127.0.0.1-0: Request 24 GET / HTTP/1.1
        LOG: 5 5003-127.0.0.1-0: main.: invoking handler: cgi
        LOG: 5 5003-127.0.0.1-0: suffix=.cgi,.pl root=/var/www/cgi-bin url: /
        LOG: 5 5003-127.0.0.1-0: Checking for suffix: .cgi
        LOG: 5 5003-127.0.0.1-0: looking for: /var/www/cgi-bin/.cgi
        LOG: 5 5003-127.0.0.1-0: Checking for suffix: .pl
        LOG: 5 5003-127.0.0.1-0: looking for: /var/www/cgi-bin/.pl
        LOG: 5 5003-127.0.0.1-0: main.: invoking handler: file
        LOG: 5 5003-127.0.0.1-0: file.: Looking for file: (/var/www/html)(/)
        LOG: 4 5003-127.0.0.1-0: file.: no such file: /var/www/html/index.html
        LOG: 3 5003-127.0.0.1-0: Error: 404 Not Found: /
        LOG: 3 5003-127.0.0.1-0: request done
        LOG: 4 5003-127.0.0.1-0: socket close

        And the built-in browser outputs:

        Got the error: Not Found
        while trying to obtain /

        If I add an index.html file to /var/www/html, then this is what I get:

        Found default config file
        Server started on 5003
        LOG: 5 5003-server: main.: starting handler: cgi
        LOG: 5 5003-server: main.: starting handler: file
        LOG: 4 5003-server: 127.0.0.1: new connection
        LOG: 3 5003-127.0.0.1-0: Request 24 GET / HTTP/1.1
        LOG: 5 5003-127.0.0.1-0: main.: invoking handler: cgi
        LOG: 5 5003-127.0.0.1-0: suffix=.cgi,.pl root=/var/www/cgi-bin url: /
        LOG: 5 5003-127.0.0.1-0: Checking for suffix: .cgi
        LOG: 5 5003-127.0.0.1-0: looking for: /var/www/cgi-bin/.cgi
        LOG: 5 5003-127.0.0.1-0: Checking for suffix: .pl
        LOG: 5 5003-127.0.0.1-0: looking for: /var/www/cgi-bin/.pl
        LOG: 5 5003-127.0.0.1-0: main.: invoking handler: file
        LOG: 5 5003-127.0.0.1-0: file.: Looking for file: (/var/www/html)(/)
        LOG: 3 5003-127.0.0.1-0: request done
        LOG: 3 5003-127.0.0.1-0: Error: 408 Request Time-out: Read timed out
        LOG: 4 5003-127.0.0.1-0: socket close

        (Note the Error: 408 above... which does not seem to cause any problems... yet).

        And the built-in browser outputs:
        Hello there!

        For #2, yes, debugging non-CGI scripts works great. The issue I described is just when trying to debug a CGI script. I'll investigate the state of the connection(s) a little more and post what I find here.

         
    • rplawetzki
      rplawetzki
      2007-12-19

      Hello,

      I just wanted to let you know, that I had the same problems using DEBUG mode with a simple CGI-script.
      Sometimes it worked once after Eclipse started, often the result was "Could not connect to debug port" right away.

      Problemes occured with EPIC 0.5.41 (stable) and debian Eclipse 3.2.1-4 on Linux debian Etch with kernel 2.6.18-5-686.
      After reading http://sourceforge.net/forum/message.php?msg_id=4569076 I installed EPIC 0.6.17 (testing) and DEBUG mode works now with the Firefox Adapter as 'Browser' which is OK for me because my standard browser is Iceweasel (the debian version of Firefox). Build-in Browser as 'Browser' still leads to "Could not connect to debug port".

      Regards,
      Ralph

       
      • r_olivieri
        r_olivieri
        2007-12-19

        Hi,

        Thanks for your comments. I tried using Firefox instead of the built-in browser but it did not make a difference in my case. I still got the "Could not connect to debug port" message and then the "web server" process died. I haven't been able yet to figure out what is wrong. In my case, it always fails when I try to debug a CGI script.

        My environment is: Eclipse 3.3.1.1, Linux Red Hat Enterprise Linux Client release 5 (Tikanga), kernel - 2.6.18-8.1.4.el5

         
        • rplawetzki
          rplawetzki
          2007-12-31

          Hi,

          I tried Ubuntu 7.10.
          You can install Eclipse 3.2.2 and JRE 6 out of the box via the package management system.
          After installing libpadwalker-perl via the package management system too (again very easy) EPIC stable can be installed and everything works: the debug mode, connecting to Firefox and displaying variable contents in den variable view during debugging.

          This might be an alternative for you.

          Regards,

          Ralph