Tuesday, 25 October 2016

Cntlm daemon restart is slow (Fedora23)

Everything started with 

$ sudo systemctl restart cntlm.service being very slow - it takes a minute or more.

So I started digging why.
I simply tried to stop it and then check how it looks during stopping.

Reproduced in Fedora23 and Fedora24

Running:

$ sudo systemctl start cntlm.service

$ sudo systemctl status cntlm.service -l
● cntlm.service - CNTLM HTTP Accelerator For NTLM Secured Proxies Authenticator
   Loaded: loaded (/usr/lib/systemd/system/cntlm.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2016-10-25 12:34:33 CEST; 6min ago
  Process: 23537 ExecStart=/usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid (code=exited, status=0/SUCCESS)
 Main PID: 23540 (cntlm)
   Memory: 2.5M
      CPU: 257ms
  CGroup: /system.slice/cntlm.service
           └─23540 /usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid

Oct 25 12:39:23 mylaptop cntlm[23540]: 127.0.0.1 CONNECT ssl.gstatic.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT lh5.googleusercontent.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT csi.gstatic.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT plus.google.com:443
Oct 25 12:39:25 mylaptop cntlm[23540]: 127.0.0.1 CONNECT i18n-cloud.appspot.com:443
Oct 25 12:39:26 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:27 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:40 mylaptop cntlm[23540]: 127.0.0.1 CONNECT webpoolam30e10.infra.lync.com:443
Oct 25 12:40:35 mylaptop cntlm[23540]: 127.0.0.1 CONNECT accounts.google.com:443
Oct 25 12:40:36 mylaptop cntlm[23540]: 127.0.0.1 CONNECT beacons.gvt2.com:443

After recieving stop signal:

$ sudo systemctl stop cntlm.service

$ sudo systemctl status cntlm.service -l

● cntlm.service - CNTLM HTTP Accelerator For NTLM Secured Proxies Authenticator
   Loaded: loaded (/usr/lib/systemd/system/cntlm.service; enabled; vendor preset: disabled)
   Active: deactivating (stop-sigterm) since Tue 2016-10-25 12:41:10 CEST; 11s ago
  Process: 23537 ExecStart=/usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid (code=exited, status=0/SUCCESS)
 Main PID: 23540 (cntlm)
   Memory: 2.5M
      CPU: 260ms
   CGroup: /system.slice/cntlm.service
           └─23540 /usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT csi.gstatic.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT plus.google.com:443
Oct 25 12:39:25 mylaptop cntlm[23540]: 127.0.0.1 CONNECT i18n-cloud.appspot.com:443
Oct 25 12:39:26 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:27 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:40 mylaptop cntlm[23540]: 127.0.0.1 CONNECT webpoolam30e10.infra.lync.com:443
Oct 25 12:40:35 mylaptop cntlm[23540]: 127.0.0.1 CONNECT accounts.google.com:443
Oct 25 12:40:36 mylaptop cntlm[23540]: 127.0.0.1 CONNECT beacons.gvt2.com:443
Oct 25 12:41:10 mylaptop systemd[1]: Stopping CNTLM HTTP Accelerator For NTLM Secured Proxies Authenticator...
Oct 25 12:41:10 mylaptop cntlm[23540]: Signal 15 received, issuing clean shutdown

After waiting a minute or more:

Thursday, 6 October 2016

PhpStorm XDebug configuration when using VM (Vagrant)

I would like to take notes how I did my set up of PhpStorm IDE for debugging with XDebug with the server running on VM (Vagrant). I assume that this configuration will work also for other type of environments where you need to use remote debugging.

Server configuration

At first you have to install XDebug (out of scope of this article).

On the vagrant machine we need kind of this configuration in /etc/php.ini
[xdebug]
zend_extension=/home/www/PHP/php-5.5.22/lib/php/extensions/xdebug.so
xdebug.max_nesting_level=9999
xdebug.profiler_output_dir=/tmp/
xdebug.profiler_output_name=xdebug-%p
xdebug.profiler_append=1
xdebug.profiler_enable_trigger=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=10.0.25.21
;xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
xdebug.remote_autostart=1
xdebug.profiler_enable=0
xdebug.trace_options=1

Restart apache or php processes (depending on your server setup).

Important settings are: remote_host, idekey, remote_enable, remote_autostart