Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification check fails if more than one package material refers to the same repository #8

Open
heterotopian opened this issue May 26, 2015 · 1 comment

Comments

@heterotopian
Copy link

If two or more package materials are defined that refer to a single repository, every modification check for those package materials will fail due to some sort of FileLock race condition triggered by DebRepositoryPoller#getLatestRevision():

2015-05-26 02:08:36,614  WARN [87@MessageListener for MaterialUpdateListener] MaterialDatabaseUpdater:121 - [Material Update] Modification check failed for material: Repository: [repo_url=http://REPOSITORY_HOST/main/binary-amd64/] - Package: [package_name=DEBIAN_PACKAGE_NAME]
java.lang.RuntimeException: 
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:317)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:245)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager.doOn(DefaultPluginManager.java:114)
        at com.thoughtworks.go.plugin.access.packagematerial.ApiBasedPackageRepositoryExtension.latestModificationSince(ApiBasedPackageRepositoryExtension.java:95)
        at com.thoughtworks.go.plugin.access.packagematerial.PackageAsRepositoryExtension.latestModificationSince(PackageAsRepositoryExtension.java:68)
        at com.thoughtworks.go.server.service.materials.PackageMaterialPoller.modificationsSince(PackageMaterialPoller.java:63)
        at com.thoughtworks.go.server.service.materials.PackageMaterialPoller.modificationsSince(PackageMaterialPoller.java:41)
        at com.thoughtworks.go.server.service.MaterialService.modificationsSince(MaterialService.java:110)
        at com.thoughtworks.go.server.materials.ScmMaterialUpdater.insertLatestOrNewModifications(ScmMaterialUpdater.java:52)
        at com.thoughtworks.go.server.materials.PackageMaterialUpdater.insertLatestOrNewModifications(PackageMaterialUpdater.java:61)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.insertLatestOrNewModifications(MaterialDatabaseUpdater.java:155)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.updateMaterialWithNewRevisions(MaterialDatabaseUpdater.java:147)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater$2.doInTransaction(MaterialDatabaseUpdater.java:110)
        at com.thoughtworks.go.server.transaction.TransactionCallback.doWithExceptionHandling(TransactionCallback.java:24)
        at com.thoughtworks.go.server.transaction.TransactionTemplate$3.doInTransaction(TransactionTemplate.java:53)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at com.thoughtworks.go.server.transaction.TransactionTemplate.executeWithExceptionHandling(TransactionTemplate.java:49)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.updateMaterial(MaterialDatabaseUpdater.java:107)
        at com.thoughtworks.go.server.materials.MaterialUpdateListener.onMessage(MaterialUpdateListener.java:48)
        at com.thoughtworks.go.server.materials.MaterialUpdateListener.onMessage(MaterialUpdateListener.java:29)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:65)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:50)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: 
        at com.tw.go.plugin.material.artifactrepository.deb.poller.DebRepositoryPoller.getLatestRevision(DebRepositoryPoller.java:41)
        at com.tw.go.plugin.material.artifactrepository.deb.poller.DebRepositoryPoller.latestModificationSince(DebRepositoryPoller.java:56)
        at com.thoughtworks.go.plugin.access.packagematerial.ApiBasedPackageRepositoryExtension$6.execute(ApiBasedPackageRepositoryExtension.java:91)
        at com.thoughtworks.go.plugin.access.packagematerial.ApiBasedPackageRepositoryExtension$6.execute(ApiBasedPackageRepositoryExtension.java:88)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:315)
        ... 22 more
Caused by: java.nio.channels.OverlappingFileLockException
        at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
        at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
        at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1012)
        at java.nio.channels.FileChannel.lock(FileChannel.java:1052)
        at com.tw.pkg.deb.helper.IOHelper.getLockOnFile(IOHelper.java:47)
        at com.tw.pkg.deb.repo.DebianRepoQuery.<init>(DebianRepoQuery.java:42)
        at com.tw.go.plugin.material.artifactrepository.deb.poller.DebRepositoryPoller.getLatestRevision(DebRepositoryPoller.java:37)
        ... 26 more

This bug will probably be a showstopper for anyone who wants to use Go to build a CD workflow that uses private Debian repositories for managing binaries.

OS: Ubuntu 12.04
Go version: confirmed behavior with 14.4 and 15.1

@paul-pop
Copy link

paul-pop commented Jul 4, 2016

+1 @heterotopian

Edit: Temporary workaround is to create a cron job that removes the lock file and cached packages in /tmp/deb-repo-query every X seconds. This will forcefully release the lock so the poller can do it's job.

while [ true ]; do
    sleep 30
    rm -rf /tmp/deb-repo-query/*
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants