Epic Error : Could not connect to debug port!

maqsoum wrote on Fri Feb  8 16:55:21 CET 2008:
 I am trying to use the debugger for a perl CGI application,
I have a Perl CGI lauch config :
html root :
  /home/maxime/workspace/www/mona/
startup html file (If I use a .pl file as a startup, it get's sent 'as is'
to the browser)
  /home/maxime/workspace/www/mona/cgi-bin/dummy.html
cgi-bin root :
  /home/maxime/workspace/www/mona/

 When I launch the debug config, I get my dummy html page shown, about 10
seconds
later I get an eclipse error dialog saying : 

   Could not connect to debug port!

 I have seen this problem in previous forum posts, but
none of the solutions worked form me.

 Note that I can debug normal perl scripts, the problem is only
with cgi scripts.

 I have PadWalker 1.7 

 I am willing to spend some time trying to debug this, for
I will be needing to debug perl cgi's pretty intensly 
(bad karma I guess ! ;))

 To verify my understanding, 
 - epic launches a java webserver (wich one?)
 - the server launches the perl interpreter (in debug mode) with the cgi
script,
   passes it the http request parameters
 - the perl debuger tries listens on a port,

 - epic tries to talk to the debugger on a given port
---------OR----------
 - the debugger on tries to talp to epic on a given port
   (in this case epic would have lauched the debuger specifying  a port)

 I would love to see the full (java) stack trace of this socket read failure....

  Anyways, I need to get this working, I have pretty extensive java experience
 but little perl experience.

Found default config file
Server started on 5004
LOG: 5 5004-server: main.: starting handler: cgi
LOG: 5 5004-server: main.: starting handler: file
LOG: 4 5004-server: 127.0.0.1: new connection
LOG: 3 5004-127.0.0.1-0: Request 24 GET /cgi-bin/bidon.html HTTP/1.1
LOG: 5 5004-127.0.0.1-0: main.: invoking handler: cgi
LOG: 5 5004-127.0.0.1-0: suffix=.cgi,.pl root=/home/maxime/workspace/www/mona/
url: /cgi-bin/bidon.html
LOG: 5 5004-127.0.0.1-0: Checking for suffix: .cgi
LOG: 5 5004-127.0.0.1-0: looking for: /home/maxime/workspace/www/mona/cgi-bin.cgi
LOG: 5 5004-127.0.0.1-0: looking for: /home/maxime/workspace/www/mona/cgi-bin/bidon.html.cgi
LOG: 5 5004-127.0.0.1-0: Checking for suffix: .pl
LOG: 5 5004-127.0.0.1-0: looking for: /home/maxime/workspace/www/mona/cgi-bin.pl
LOG: 5 5004-127.0.0.1-0: looking for: /home/maxime/workspace/www/mona/cgi-bin/bidon.html.pl
LOG: 5 5004-127.0.0.1-0: main.: invoking handler: file
LOG: 5 5004-127.0.0.1-0: file.: Looking for file: (/home/maxime/workspace/www/mona/)(/cgi-bin/bidon.html)
LOG: 3 5004-127.0.0.1-0: request done


 Eclipse config :
*** Platform Details:

*** System properties:
eclipse.buildId=M20070212-1330
eclipse.commands=-os
linux
-ws
gtk
-arch
x86
-launcher
/usr/lib/eclipse/eclipse
-name
Eclipse
-showsplash
600
-exitdata
1fd8001
-install
/usr/lib/eclipse
-vm
/usr/lib/jvm/java-6-sun/bin/java
eclipse.ee.install.verify=false
eclipse.product=org.eclipse.sdk.ide
eclipse.startTime=1202483604776
eclipse.vm=/usr/lib/jvm/java-6-sun/bin/java
eclipse.vmargs=-Djava.library.path=/usr/lib/jni
-Dgnu.gcj.precompiled.db.path=/var/lib/gcj-4.2/classmap.db
-Dgnu.gcj.runtime.VMClassLoader.library_control=never
-Dosgi.locking=none
-jar
/usr/lib/eclipse/startup.jar
eof=eof
file.encoding=UTF-8
file.encoding.pkg=sun.io
file.separator=/
gnu.gcj.precompiled.db.path=/var/lib/gcj-4.2/classmap.db
gnu.gcj.runtime.VMClassLoader.library_control=never
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.awt.printerjob=sun.print.PSPrinterJob
java.class.path=/usr/lib/eclipse/startup.jar
java.class.version=50.0
java.endorsed.dirs=/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/endorsed
java.ext.dirs=/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/ext:/usr/java/packages/lib/ext
java.home=/usr/lib/jvm/java-6-sun-1.6.0.03/jre
java.io.tmpdir=/tmp
java.library.path=/usr/lib/jni
java.runtime.name=Java(TM) SE Runtime Environment
java.runtime.version=1.6.0_03-b05
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.6
java.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
java.version=1.6.0_03
java.vm.info=mixed mode, sharing
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Sun Microsystems Inc.
java.vm.version=1.6.0_03-b05
line.separator=

org.osgi.framework.bootdelegation=*
org.osgi.framework.executionenvironment=OSGi/Minimum-1.0,OSGi/Minimum-1.1,JRE-1.1,J2SE-1.2,J2SE-1.3,J2SE-1.4,J2SE-1.5,JavaSE-1.6
org.osgi.framework.language=en
org.osgi.framework.os.name=Linux
org.osgi.framework.os.version=2.6.22-14-generic
org.osgi.framework.processor=i386
org.osgi.framework.system.packages=javax.accessibility,javax.activity,javax.crypto,javax.crypto.interfaces,javax.crypto.spec,javax.imageio,javax.imageio.event,javax.imageio.metadata,javax.imageio.plugins.bmp,javax.imageio.plugins.jpeg,javax.imageio.spi,javax.imageio.stream,javax.management,javax.management.loading,javax.management.modelmbean,javax.management.monitor,javax.management.openmbean,javax.management.relation,javax.management.remote,javax.management.remote.rmi,javax.management.timer,javax.naming,javax.naming.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi,javax.net,javax.net.ssl,javax.print,javax.print.attribute,javax.print.attribute.standard,javax.print.event,javax.rmi,javax.rmi.CORBA,javax.rmi.ssl,javax.security.auth,javax.security.auth.callback,javax.security.auth.kerberos,javax.security.auth.login,javax.security.auth.spi,javax.security.auth.x500,javax.security.cert,javax.security.sasl,javax.sound.midi,javax.sound.midi.spi,javax.sound.sampled,javax.sound.sampled.spi,javax.sql,javax.sql.rowset,javax.sql.rowset.serial,javax.sql.rowset.spi,javax.swing,javax.swing.border,javax.swing.colorchooser,javax.swing.event,javax.swing.filechooser,javax.swing.plaf,javax.swing.plaf.basic,javax.swing.plaf.metal,javax.swing.plaf.multi,javax.swing.plaf.synth,javax.swing.table,javax.swing.text,javax.swing.text.html,javax.swing.text.html.parser,javax.swing.text.rtf,javax.swing.tree,javax.swing.undo,javax.transaction,javax.transaction.xa,javax.xml,javax.xml.datatype,javax.xml.namespace,javax.xml.parsers,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stream,javax.xml.validation,javax.xml.xpath,org.ietf.jgss,org.omg.CORBA,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable,org.omg.CORBA.DynAnyPackage,org.omg.CORBA.ORBPackage,org.omg.CORBA.portable,org.omg.CORBA.TypeCodePackage,org.omg.CosNaming,org.omg.CosNaming.NamingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dynamic,org.omg.DynamicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.DynAnyPackage,org.omg.IOP,org.omg.IOP.CodecFactoryPackage,org.omg.IOP.CodecPackage,org.omg.Messaging,org.omg.PortableInterceptor,org.omg.PortableInterceptor.ORBInitInfoPackage,org.omg.PortableServer,org.omg.PortableServer.CurrentPackage,org.omg.PortableServer.POAManagerPackage,org.omg.PortableServer.POAPackage,org.omg.PortableServer.portable,org.omg.PortableServer.ServantLocatorPackage,org.omg.SendingContext,org.omg.stub.java.rmi,org.w3c.dom,org.w3c.dom.bootstrap,org.w3c.dom.events,org.w3c.dom.ls,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers
org.osgi.framework.vendor=Eclipse
org.osgi.framework.version=1.3.0
org.osgi.supports.framework.extension=true
os.arch=i386
os.name=Linux
os.version=2.6.22-14-generic
osgi.arch=x86
osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start,
org.eclipse.core.runtime@start
osgi.bundlestore=/home/maxime/.eclipse/org.eclipse.platform_3.2.0/configuration/org.eclipse.osgi/bundles
osgi.configuration.area=file:/home/maxime/.eclipse/org.eclipse.platform_3.2.0/configuration/
osgi.framework=file:/usr/lib/eclipse/plugins/org.eclipse.osgi_3.2.2.R32x_v20070118.jar
osgi.framework.beginningstartlevel=1
osgi.framework.shape=jar
osgi.framework.version=3.2.2.R32x_v20070118
osgi.install.area=file:/usr/lib/eclipse/
osgi.instance.area=file:/home/maxime/workspace/
osgi.instance.area.default=file:/home/maxime/workspace/
osgi.locking=none
osgi.logfile=/home/maxime/workspace/.metadata/.log
osgi.manifest.cache=/home/maxime/.eclipse/org.eclipse.platform_3.2.0/configuration/org.eclipse.osgi/manifests
osgi.nl=en_CA
osgi.os=linux
osgi.sharedConfiguration.area=file:/usr/lib/eclipse/configuration/
osgi.splashLocation=/usr/lib/eclipse/plugins/org.eclipse.platform_3.2.2.r322_v20070117b/splash.bmp
osgi.splashPath=platform:/base/plugins/org.eclipse.platform
osgi.syspath=/usr/lib/eclipse/plugins
osgi.ws=gtk
path.separator=:
sourceCriticEnabled=true
sun.arch.data.model=32
sun.boot.class.path=/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/resources.jar:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/jsse.jar:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/jce.jar:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/charsets.jar:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/classes
sun.boot.library.path=/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/i386
sun.cpu.endian=little
sun.cpu.isalist=
sun.io.unicode.encoding=UnicodeLittle
sun.java.launcher=SUN_STANDARD
sun.jnu.encoding=UTF-8
sun.management.compiler=HotSpot Client Compiler
sun.os.patch.level=unknown
user.country=CA
user.dir=/home/maxime
user.home=/home/maxime
user.language=en
user.name=maxime
user.timezone=America/Montreal
maqsoum wrote on Fri Feb  8 17:00:53 CET 2008:
 Forgot to mention, I am using the latest 0.6.18 epic version
jploski wrote on Fri Feb  8 19:44:48 CET 2008:
Here is how it works:

- epic launches a java webserver called 'Brazil' from Sun; quite an old
version of it; it uses an epic-provided "handler" to process the requests
- the server launches the perl interpreter (in debug mode) with the cgi
script, 
passes it the http request parameters
- the debugger tries to talk to epic on a given port (in this case epic
would have launched the debuger specifying a port); furthermore stdout/stderr
are redirected via tcp sockets from the running script to epic (this can
be suppressed by an option in the launch configuration)

For testing, create a new project with a single CGI script and create a
launch configuration with
root directory = absolute path to the project
html startup file = absolute path to the CGI script
cgi root directory = absolute path to the project

If you wish to hack EPIC to see what's going on, follow the instructions
at http://e-p-i-c.sf.net/devguide/devguide.html

Note that debugging the embedded web server will be a bit tricky because
it runs in its own JVM. So the JVM would have to be started with appropriate
debug flags by epic, or you would have to start it manually.

P.S. Switch from gcj to Sun's Java for greatly improved performance of Eclipse/epic.
maqsoum wrote on Mon Feb 11 15:33:43 CET 2008:
  Ok, I got it to work, I started a single file project that worked,
than mimicked the config for my real project, 

web root :
/home/maxime/workspace/www/mona/cgi-bin/
html start :
/home/maxime/workspace/www/mona/cgi-bin/index.pl
cgi root :
/home/maxime/workspace/www/mona/cgi-bin/

 Thanks !

Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.