Bug 218654

Summary: textproc/apache-solr do not use lsof in startup script
Product: Ports & Packages Reporter: Wiktor Niesiobedzki <bsd>
Component: Individual Port(s)Assignee: Larry Rosenman <ler>
Status: Closed FIXED    
Severity: Affects Only Me CC: ler, mfechner
Priority: --- Flags: bugzilla: maintainer-feedback? (mfechner)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch for apache-solr port
none
patch for apache-solr 6.5.0
none
Use sockstat instead of lsof for apache-solr 6.5.0 mfechner: maintainer-approval+

Description Wiktor Niesiobedzki 2017-04-14 13:44:00 UTC
Created attachment 181781 [details]
patch for apache-solr port

Stock apache-solr scripts use lsof during startup to check if Solr started properly.

When deploying Apache Solr in Jail lsof needs access to /dev/mem which is not allowed by default. Lack of the access makes the startup script run in the loop for 3 minutes and then it assumes that it might have succeed. 

Allowing access to /dev/mem makes running Solr in Jail a bit pointless.

Following patch changes the behaviour of Solr startup script to use sockstat instead of lsof to check if Solr has already started. This also makes the dependency on lsof obsolete.
Comment 1 Matthias Fechner freebsd_committer freebsd_triage 2017-04-15 08:52:15 UTC
this is a really good idea.
But I have already committed an update for the solr port: #218523

Would you like to update the patch for the new version?
Comment 2 Wiktor Niesiobedzki 2017-04-15 09:17:11 UTC
No problem. I can't see the changes that you've mentioned in:
https://svn.freebsd.org/ports/head

So I've applied the patch from #218523 manually and created the diff again.

So now Makefile changes report also change of the Solr version. There are minor changes in line numbers in patch.
Comment 3 Wiktor Niesiobedzki 2017-04-15 09:17:50 UTC
Created attachment 181806 [details]
patch for apache-solr 6.5.0
Comment 4 Matthias Fechner freebsd_committer freebsd_triage 2017-04-15 10:45:54 UTC
Created attachment 181808 [details]
Use sockstat instead of lsof for apache-solr 6.5.0

Thanks a lot to Wiktor!

I modified the patch a little bit to cleanly apply to the new 6.5.0 apache-solr port that is not committed yet.
Comment 5 Matthias Fechner freebsd_committer freebsd_triage 2017-04-15 10:47:28 UTC
Please commit port 218523 before you apply this patch.
I tested everything and it works fine.
Comment 6 commit-hook freebsd_committer freebsd_triage 2017-04-18 01:38:22 UTC
A commit references this bug:

Author: ler
Date: Tue Apr 18 01:37:21 UTC 2017
New revision: 438757
URL: https://svnweb.freebsd.org/changeset/ports/438757

Log:
  Stock apache-solr scripts use lsof during startup to check if Solr started properly.

  When deploying Apache Solr in Jail lsof needs access to /dev/mem which is not allowed by default. Lack of the access makes the startup script run in the loop for 3 minutes and then it assumes that it might have succeed.

  Allowing access to /dev/mem makes running Solr in Jail a bit pointless.

  Following patch changes the behaviour of Solr startup script to use sockstat instead of lsof to check if Solr has already started. This also makes the dependency on lsof obsolete.

  While here, pet portlint.

  PR:	218654
  Submitted by:	Wiktor Niesiobedzki <bsd@vink.pl>
  Approved by:	 idefix@fechner.net (maintainer), adamw (mentor)
  Differential Revision:	https://reviews.freebsd.org/D10416

Changes:
  head/textproc/apache-solr/Makefile
  head/textproc/apache-solr/files/patch-bin_solr
  head/textproc/apache-solr/files/solr.in
Comment 7 Larry Rosenman freebsd_committer freebsd_triage 2017-04-18 01:39:26 UTC
Committed, thanks!