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

[Bug]: integrity constraint violation when indexing music #628

Open
1b0u opened this issue Oct 13, 2024 · 0 comments
Open

[Bug]: integrity constraint violation when indexing music #628

1b0u opened this issue Oct 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@1b0u
Copy link

1b0u commented Oct 13, 2024

What happened?

I get a integrity constraint violation when indexing music - fresh install

Steps to reproduce

  1. indexing
  2. watch the logs

Version

11.1.5-SNAPSHOT (Edge)

Version Detail

11.1.5-SNAPSHOT.20240920041432

Operating System

Docker on Debian

Java Version

Java 17.0.10

Database

Other

DB Detail

hsqldb

Configuration paramter

  airsonic:
    container_name: airsonic
    image: ghcr.io/kagemomiji/airsonic-advanced
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
      - JAVA_OPTS=-Dserver.forward-headers-strategy=native
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.airsonic.entrypoints=web,websecure"
      - "traefik.http.routers.airsonic.rule=Host(`${MUSIC_DOMAIN_NAME}`)"
      - "traefik.http.routers.airsonic.tls=true"
      - "traefik.http.routers.airsonic.tls.certresolver=le-resolver"
      - "traefik.http.routers.airsonic.tls.options=mytlsoption@file"
      - "traefik.http.routers.airsonic.middlewares=airsonicsecurity@file"
      - "traefik.http.services.airsonic.loadbalancer.server.port=4040"
    volumes:
      - airsonic_data:/var/airsonic
      - /srv/music:/var/music:ro
      - airsonic_podcasts:/var/podcasts
      - airsonic_playlists:/var/playlists
    restart: unless-stopped

Proxy Server

Traefik

client detail

Brave

language

French

Relevant log output

2024-10-13 03:03:43.129  INFO --- o.a.p.s.MediaScannerService              : Persisting albums
2024-10-13 03:03:43.148  WARN --- o.h.e.j.spi.SqlExceptionHelper           : SQL Error: -104, SQLState: 23505
2024-10-13 03:03:43.148 ERROR --- o.h.e.j.spi.SqlExceptionHelper           : integrity constraint violation: unique constraint or index violation: IDX_ALBUM_ARTIST_NAME
2024-10-13 03:03:43.178  INFO --- o.a.p.s.MediaScannerService              : Persisting artists
2024-10-13 03:03:43.203  INFO --- o.a.p.s.MediaScannerService              : Persisting media files
2024-10-13 03:03:43.203  INFO --- o.a.p.s.MediaScannerService              : Persisting genres
2024-10-13 03:03:57.425  WARN --- o.h.e.j.spi.SqlExceptionHelper           : SQL Error: -104, SQLState: 23505
2024-10-13 03:03:57.425 ERROR --- o.h.e.j.spi.SqlExceptionHelper           : integrity constraint violation: unique constraint or index violation: IDX_ARTIST_NAME
2024-10-13 03:03:58.945  INFO --- o.a.p.s.MediaScannerService              : Marking non-present media files.
2024-10-13 03:03:58.946  INFO --- o.a.p.s.MediaScannerService              : Updating genres
2024-10-13 03:03:59.039  INFO --- o.a.p.s.MediaScannerService              : Genre persistence successfully complete: true
2024-10-13 03:04:02.676  INFO --- o.a.p.s.MediaScannerService              : Media file persistence complete
2024-10-13 03:04:02.676 ERROR --- o.a.p.s.MediaScannerService              : Failed to scan media library.
java.util.concurrent.CompletionException: org.springframework.dao.DataIntegrityViolationException: could not execute statement [integrity constraint violation: unique constraint or index violation: IDX_ALBUM_ARTIST_NAME] [insert into album (artist,comment,created,duration,folder_id,genre,last_played,last_scanned,mb_release_id,name,path,play_count,present,song_count,year,id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,default)]; SQL [insert into album (artist,comment,created,duration,folder_id,genre,last_played,last_scanned,mb_release_id,name,path,play_count,present,song_count,year,id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,default)]; constraint [null]
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[na:na]
Caused by: org.springframework.dao.DataIntegrityViolationException: could not execute statement [integrity constraint violation: unique constraint or index violation: IDX_ALBUM_ARTIST_NAME] [insert into album (artist,comment,created,duration,folder_id,genre,last_played,last_scanned,mb_release_id,name,path,play_count,present,song_count,year,id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,default)]; SQL [insert into album (artist,comment,created,duration,folder_id,genre,last_played,last_scanned,mb_release_id,name,path,play_count,present,song_count,year,id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,default)]; constraint [null]
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:290) ~[spring-orm-6.1.13.jar:6.1.13]
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:241) ~[spring-orm-6.1.13.jar:6.1.13]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:550) ~[spring-orm-6.1.13.jar:6.1.13]
	at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61) ~[spring-tx-6.1.13.jar:6.1.13]
	at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:335) ~[spring-tx-6.1.13.jar:6.1.13]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:160) ~[spring-tx-6.1.13.jar:6.1.13]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:165) ~[spring-data-jpa-3.3.4.jar:3.3.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223) ~[spring-aop-6.1.13.jar:6.1.13]
	at jdk.proxy2/jdk.proxy2.$Proxy221.save(Unknown Source) ~[na:na]
	at org.airsonic.player.service.AlbumService.save_aroundBody12(AlbumService.java:378) ~[classes/:na]
	at org.airsonic.player.service.AlbumService$AjcClosure13.run(AlbumService.java:1) ~[classes/:na]
	at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96cproceed(AbstractTransactionAspect.aj:67) ~[spring-aspects-6.1.13.jar:6.1.13]
	at org.springframework.transaction.aspectj.AbstractTransactionAspect$AbstractTransactionAspect$1.proceedWithInvocation(AbstractTransactionAspect.aj:73) ~[spring-aspects-6.1.13.jar:6.1.13]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:379) ~[spring-tx-6.1.13.jar:6.1.13]
	at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:71) ~[spring-aspects-6.1.13.jar:6.1.13]
	at org.airsonic.player.service.AlbumService.save(AlbumService.java:377) ~[classes/:na]
	at org.airsonic.player.service.MediaScannerService.lambda$10(MediaScannerService.java:281) ~[classes/:na]
	... 7 common frames omitted
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement [integrity constraint violation: unique constraint or index violation: IDX_ALBUM_ARTIST_NAME] [insert into album (artist,comment,created,duration,folder_id,genre,last_played,last_scanned,mb_release_id,name,path,play_count,present,song_count,year,id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,default)]
	at org.hibernate.dialect.HSQLDialect.lambda$buildSQLExceptionConversionDelegate$1(HSQLDialect.java:441) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:58) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.id.insert.GetGeneratedKeysDelegate.performMutation(GetGeneratedKeysDelegate.java:116) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:47) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:55) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.doStaticInserts(InsertCoordinatorStandard.java:194) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.coordinateInsert(InsertCoordinatorStandard.java:132) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.insert(InsertCoordinatorStandard.java:95) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:85) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:671) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:292) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:273) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:323) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:391) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:305) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:224) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:137) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:175) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:93) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:77) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:54) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:757) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:741) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:319) ~[spring-orm-6.1.13.jar:6.1.13]
	at jdk.proxy2/jdk.proxy2.$Proxy209.persist(Unknown Source) ~[na:na]
	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:626) ~[spring-data-jpa-3.3.4.jar:3.3.4]
	at jdk.internal.reflect.GeneratedMethodAccessor232.invoke(Unknown Source) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:355) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:277) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:173) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:148) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70) ~[spring-data-commons-3.3.4.jar:3.3.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:379) ~[spring-tx-6.1.13.jar:6.1.13]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-6.1.13.jar:6.1.13]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.13.jar:6.1.13]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138) ~[spring-tx-6.1.13.jar:6.1.13]
	... 22 common frames omitted
Caused by: java.sql.SQLIntegrityConstraintViolationException: integrity constraint violation: unique constraint or index violation: IDX_ALBUM_ARTIST_NAME
	at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-5.1.0.jar:na]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-5.1.0.jar:na]
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:194) ~[hibernate-core-6.5.3.Final.jar:6.5.3.Final]
	... 71 common frames omitted
Caused by: org.hsqldb.HsqlException: integrity constraint violation: unique constraint or index violation: IDX_ALBUM_ARTIST_NAME
	at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.index.IndexAVL.insert(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.persist.RowStoreAVL.indexRow(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.persist.RowStoreAVLDisk.indexRow(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.TransactionManagerMVCC.addInsertAction(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.Session.addInsertAction(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.Table.insertSingleRow(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.StatementDML.insertRowSet(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.StatementInsert.getResult(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.StatementDMQL.execute(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.Session.executeCompiledStatement(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	at org.hsqldb.Session.execute(Unknown Source) ~[hsqldb-2.7.3.jar:2.7.3]
	... 76 common frames omitted
@1b0u 1b0u added the bug Something isn't working label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant