Bug 218654 - textproc/apache-solr do not use lsof in startup script
Summary: textproc/apache-solr do not use lsof in startup script
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Larry Rosenman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-14 13:44 UTC by Wiktor Niesiobedzki
Modified: 2017-04-18 01:39 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (mfechner)


Attachments
patch for apache-solr port (2.25 KB, patch)
2017-04-14 13:44 UTC, Wiktor Niesiobedzki
no flags Details | Diff
patch for apache-solr 6.5.0 (2.44 KB, patch)
2017-04-15 09:17 UTC, Wiktor Niesiobedzki
no flags Details | Diff
Use sockstat instead of lsof for apache-solr 6.5.0 (2.33 KB, patch)
2017-04-15 10:45 UTC, Matthias Fechner
mfechner: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!