Bug 160580 - databases/postgresql[89] broken
Summary: databases/postgresql[89] broken
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Palle Girgensohn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-09 09:00 UTC by Eugene M. Zheganin
Modified: 2011-12-05 17:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene M. Zheganin 2011-09-09 09:00:19 UTC
databases/postgresql[89] port broken.

New versions of postgresql library libpq contain pthread_mutex_unlock()
syscall (fe-connect.c file). When using postgresql along with net/samba35
(both times I got this bug with net/samba35, I'm not sure if it's
reproduceable with older or other versions of samba port), and, especially,
it's nss_winbind.so library (including it in nsswitch.conf configuration
file) the psql console utility fails to start, complaining about failed
to unlock mutex.

The server itself also complains about this error, but starts and works fine.

Being recompiled with custom patch against fe-connect.c, to display what
exactly pthread_mutex_unlock() call returns, I can say that it returns 1,
which is the EPERM error.

There is an opinion from one of FreeBSD developers, which states that
pthread code is broken in FreeBSD port patches, not in postgresql itself.

There are several workarounds about this problem.

Fix: 

1) Stop using nss_winbind.so backend
2) Assemble the port without port patches, commenting out the post-patch:
   target in port Makefile.
How-To-Repeat: Install databases/postgresql90-server port. Install net/samba35 port.
Configure nsswitch.conf to use nss_winbind.so backend. Launch psql.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-09-10 01:02:02 UTC
Responsible Changed
From-To: freebsd-ports-bugs->girgen

Over to maintainer of databases/postgresql90-server.
Comment 2 Stanislav Sedov freebsd_committer freebsd_triage 2011-09-13 00:31:02 UTC
Just to clarify this a bit, we actually tracked this problem down
to the fact the linking with -pthread was disabled in the port for
some reason.  It is probably wrong, and it prevents libpq to be used
in applications which load threaded libraries as well,
like nss_winbind.so.

What is the reason the -pthreads link flags is pulled of the Makefile?

Thanks!

-- 
Stanislav Sedov
ST4096-RIPE

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments
Comment 3 R.Mahmatkhanov 2011-10-16 20:33:20 UTC
Please note that there is pr with fix suffering the same problem:

http://bugs.freebsd.org/146187

-- 
Regards,
Ruslan

Tinderboxing kills... the drives.
Comment 4 Palle Girgensohn 2011-12-05 16:29:22 UTC
The main reason for this is the following commit:

-- databases/postgresql90-server/Makefile
revision 1.197
date: 2010/01/04 20:29:37;  author: ale;  state: Exp;  lines: +4 -0
Don't link unneeded PTHREAD_LIBS. This fixes php extensions and apache 
modules.


I have tested this with apache22 and php
postgresql 9.0 with the 1.197 fix reverted
php with and without LINKTHR
and it works for me in a simple environment.

As I cannot reproduce this error, and the change breaks things for others, 
I feel inclined to revert 1.197.
Comment 5 dfilter service freebsd_committer freebsd_triage 2011-12-05 16:45:28 UTC
girgen      2011-12-05 16:45:14 UTC

  FreeBSD ports repository

  Modified files:
    databases/postgresql82-server Makefile 
    databases/postgresql83-server Makefile 
    databases/postgresql84-server Makefile distinfo 
                                  pkg-plist-client 
                                  pkg-plist-server 
    databases/postgresql90-server Makefile distinfo 
                                  pkg-plist-server 
    databases/postgresql91-server Makefile distinfo 
                                  pkg-plist-server 
  Log:
  The PostgreSQL Global Development Group today released updates for all
  active branches of the PostgreSQL object-relational database system,
  including versions 9.1.2, 9.0.6, 8.4.10, 8.3.17 and 8.2.23.
  
  This release contains 52 fixes to version 9.1, and a smaller number of
  fixes to older versions, including:
  
  - Fix bugs in information_schema.referential_constraints view**
  - Correct collations for citext columns and indexes**
  - Prevent possible crash when joining to a scalar function
  - Prevent transitory data corruption of GIN indexes after a crash
  - Prevent data corruption on TOAST columns when copying data
  - Fix failures during hot standby startup
  - Correct another "variable not found in subplan target list" bug
  - Fix bug with sorting on aggregate expressions in windowing functions
  - Multiple bug fixes for pg_upgrade
  - Change Foreign Key creation order to better support
   self-referential keys**
  - Multiple bug fixes to CREATE EXTENSION
  - Ensure that function return type and data returned from PL/perl agree
  - Ensure that PL/perl strings are always UTF-8
  - Assorted bug fixes for various Extensions
  - Updates to the time zone database, particularly to CST6
  
  Changes marked with ** above require additional, post-update steps in
  order to fix all described issues.
  
  URL:    http://www.postgresql.org/docs/current/static/release.html
  
  Also, fix a pthread problem in the FreeBSD port. [1]
  PR:     160580 [1]
  Feature safe:   yes
  
  Revision  Changes    Path
  1.206     +0 -2      ports/databases/postgresql82-server/Makefile
  1.219     +0 -1      ports/databases/postgresql83-server/Makefile
  1.239     +3 -5      ports/databases/postgresql84-server/Makefile
  1.83      +2 -2      ports/databases/postgresql84-server/distinfo
  1.22      +1 -0      ports/databases/postgresql84-server/pkg-plist-client
  1.36      +1 -0      ports/databases/postgresql84-server/pkg-plist-server
  1.232     +3 -5      ports/databases/postgresql90-server/Makefile
  1.83      +2 -2      ports/databases/postgresql90-server/distinfo
  1.36      +1 -0      ports/databases/postgresql90-server/pkg-plist-server
  1.234     +4 -20     ports/databases/postgresql91-server/Makefile
  1.89      +2 -2      ports/databases/postgresql91-server/distinfo
  1.39      +1 -0      ports/databases/postgresql91-server/pkg-plist-server
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 Palle Girgensohn freebsd_committer freebsd_triage 2011-12-05 17:08:53 UTC
State Changed
From-To: open->closed

Removed the problematic replace command. See PR history. 
I could not reproduce the original problem that led to  
the replace command to be introduced.