The attachment "etc_initd_jetty.reachable.patch" seems to be a patch.
If it isn't, please remove the "patch" flag from the attachment, remove
the "patch" tag, and if you are a member of the ~ubuntu-reviewers,
unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issues please contact him.]

** Tags added: patch

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to jetty in Ubuntu.
https://bugs.launchpad.net/bugs/1646202

Title:
  jetty init file prints wrong reachable information

Status in jetty package in Ubuntu:
  New

Bug description:
  When starting/stopping Jetty via its init script (/etc/init.d/jetty),
  we can get strange/wrong/inconsistent information about the host and
  port in which Jetty is/was listen.

  This occurs in Ubuntu 14.04, but probably occurs in other
  Ubuntu/Debian versions since the `/etc/init.d/jetty` script is
  basically the same.

  I will show some examples in a fresh install of Jetty (with
  `NO_START=0`) in a machine which hostname is `ip-172-31-45-218`.

  ```
  root@ip-172-31-45-218:~# service jetty start
   * Starting Jetty servlet engine. jetty                                       
   
   * Jetty servlet engine started, reachable on http://ip-172-31-45-218:8080/. 
jetty                                                                       [ 
OK ] 
  root@ip-172-31-45-218:~# service jetty status
   * Jetty servlet engine is running with pid 5477, and is reachable on 
http://:8080/
  root@ip-172-31-45-218:~# service jetty stop
   * Stopping Jetty servlet engine (was reachable on 
http://ip-172-31-45-218:8080/). jetty                                           
                              
   * Jetty servlet engine stopped. jetty                                   [ OK 
] 
  ```

  Here, we have the first strange thing:

  - Start/stop report reachable on http://ip-172-31-45-218:8080/, while
  status reports reachable on http://:8080/. The outputs are somehow
  inconsistent.

  Running some curls:

  ```
  root@ip-172-31-45-218:~# curl http://ip-172-31-45-218:8080
  curl: (7) Failed to connect to ip-172-31-45-218 port 8080: Connection refused
  root@ip-172-31-45-218:~# curl http://127.0.0.1:8080
  root@ip-172-31-45-218:~# curl http://127.0.0.1:8080
  <HTML>
    <HEAD>
      <TITLE>Welcome to Jetty 6 on Debian</TITLE>
  [...]
  ```

  Even if we put `127.0.1.1 ip-172-31-45-218` or `172.31.45.218
  ip-172-31-45-218` in `/etc/hosts`, as expected in Ubuntu hosts` in
  `/etc/hosts`, as expected in Ubuntu hosts, the first curl won't work.

  This is because Jetty listens on 127.0.0.1 / ::1 when no host is
  informed:

  ```
  root@ip-172-31-45-218:~# netstat -anlp | grep 8080
  tcp6       0      0 127.0.0.1:8080          :::*                    LISTEN    
  5613/jsvc.exec
  ```

  The same thing will happen if we change Jetty to listen in a specific
  IP address different than the represented by the hostname.

  Now, the second thing:

  - Start/stop can print unreachable address (Jetty is NOT reachable in
  this address).

  And the third:

  - Status prints a strange address if `JETTY_HOST` is blank, and it
  should print 127.0.0.1

  Now, if we change in `/etc/default/jetty` `JETTY_HOST` to 90.90.90.90,
  do not restart Jetty (only change the config file), and run status,
  the status command will return the wrong host:

  ```
  root@ip-172-31-45-218:~# service jetty status
   * Jetty servlet engine is running with pid 5613, and is reachable on 
http://90.90.90.90:8080/
  root@ip-172-31-45-218:~# netstat -anlp | grep 8080
  tcp6       0      0 127.0.0.1:8080          :::*                    LISTEN    
  5613/jsvc.exec  
  ```

  The same thing would happen if we change the `JETTY_PORT` config.

  So, the fourth point:

  - Status can return wrong reachable information if the config file
  (host/port) was modified after Jetty had started

  There are a lot of other inconsistencies.

  In my opinion, it's easier to remove these informations in the init
  script (the admin can always check the config files and run netstat to
  get the correct info).

  But a more complex fix should consider checking netstat on stop/status
  commands, and checking the border cases (empty host - Jetty defaults
  to 12.0.0.1 / empty port - Jetty defaults to what is set in its XML
  config files, or 8080 if nothing more is changed) .

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/jetty/+bug/1646202/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to