Opened 14 years ago

Closed 14 years ago

#24858 closed defect (duplicate)

Simultaneous install of same port ends in error

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 1.8.99
Keywords: Cc:
Port:

Description

Using MacPorts 1.9.0 beta 1 on Snow Leopard with Xcode 3.2.2, things go wrong when you try to install the same port at the same time in multiple terminal windows. Doing so is obviously not terribly useful, but sometimes it happens by accident -- I may be installing one port in one window, and installing what I thought was a totally unrelated port in another window, and I didn't realize they shared some dependency that wasn't installed yet.

In this case, it ended up wanting to install autoconf in two different terminal windows. In one window, the install completed successfully, after playing tag with the other window's lockfile for a few phases:

Waiting for lock on /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_autoconf/work/.macports.autoconf.state
Waiting for lock on /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_autoconf/work/.macports.autoconf.state
Waiting for lock on /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_autoconf/work/.macports.autoconf.state
--->  Installing autoconf @2.65_1
--->  Activating autoconf @2.65_1
--->  Cleaning autoconf

Meanwhile the other terminal window, where the install began, eventually failed:

--->  Fetching autoconf
--->  Attempting to fetch autoconf-2.65.tar.bz2 from http://808.local/distfiles/autoconf
--->  Verifying checksum(s) for autoconf
--->  Extracting autoconf
--->  Applying patches to autoconf
--->  Configuring autoconf
--->  Building autoconf
Waiting for lock on /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_autoconf/work/.macports.autoconf.state
--->  Staging autoconf into destroot
Waiting for lock on /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_autoconf/work/.macports.autoconf.state
--->  Installing autoconf @2.65_1
Error: Target org.macports.install returned: sqlite error: SQL logic error or missing database (1) while executing query: INSERT INTO registry.ports (name, version, revision, variants, epoch) VALUES (?, ?, ?, ?, ?)
Log for autoconf is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_autoconf/main.log

MacPorts 1.8.2 doesn't fare much better in these situations. It doesn't use SQLite for its registry of course, but an error is still displayed.

Desirable is that multiple simultaneous attempts to install the same port somehow manage to block each other long enough that all such involved processes end up completing without error. We obviously already have lockfiles in place with the intention to prevent this problem, but during the installation phase, this protection is apparently not working.

Change History (1)

comment:1 Changed 14 years ago by jmroot (Joshua Root)

Resolution: duplicate
Status: newclosed

Same thing as #19935. It's basically a TOCTOU error, you can't install something that's already installed even if the statefile lock prevents both processes from trying it at once.

Note: See TracTickets for help on using tickets.