uyuni-project / uyuni

Source code for Uyuni
https://www.uyuni-project.org/
GNU General Public License v2.0
433 stars 181 forks source link

Internal Server Error at Product Migration #8887

Open s0rnix opened 5 months ago

s0rnix commented 5 months ago

Problem description

Hallo,

i getting Internal Server Error if i try to run produc migration and if i manually change the channels to the target version as workaround i also get "Server error, please check log files.".

with sles without sap there is no problem. it might be a problem with the channels.

anybody know how to fix?

Steps to reproduce

current Installed Product: SUSE Linux Enterprise Server for SAP Applications 15 SP4 ppc64le When i try to Migrate from SLES 15.4 to 15.5 i click on Software > Product Migration > SUSE Linux Enterprise Server for SAP Applications 15 SP5 ppc64le > Select Channels and get an "Internal Server Error".

Uyuni version

2024.03

Uyuni proxy version (if used)

No response

Useful logs

2024-06-07 10:52:12,181 [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-8] WARN  com.redhat.rhn.manager.distupgrade.DistUpgradeManager - No SUSE Product Channels for SUSE Linux Enterprise Server for SAP Applications 15 SP6 ppc64le (BETA). Skipping
2024-06-07 10:54:21,863 [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-1] WARN  com.redhat.rhn.manager.distupgrade.DistUpgradeManager - No SUSE Product Channels for SUSE Linux Enterprise Server for SAP Applications 15 SP6 ppc64le (BETA). Skipping
2024-06-07 10:55:01,847 [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-2] WARN  com.redhat.rhn.manager.distupgrade.DistUpgradeManager - No SUSE Product Channels for SUSE Linux Enterprise Server for SAP Applications 15 SP6 ppc64le (BETA). Skipping
2024-06-07 10:55:02,613 [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-2] WARN  org.apache.struts.action.RequestProcessor - Unhandled Exception thrown: class javax.persistence.PersistenceException
2024-06-07 10:55:02,614 [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-2] ERROR com.redhat.rhn.frontend.servlets.SessionFilter - Error during transaction. Rolling back
javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.HibernateException: More than one row with the given identifier was found: 2832, for class: com.redhat.rhn.domain.channel.ChannelSyncFlag
        at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) ~[struts.jar:1.2.9]
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433) ~[struts.jar:1.2.9]
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237) ~[struts.jar:1.2.9]
        at com.redhat.rhn.frontend.struts.RhnRequestProcessor.process(RhnRequestProcessor.java:104) ~[rhn.jar:?]
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) ~[struts.jar:1.2.9]
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) ~[struts.jar:1.2.9]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) ~[tomcat-servlet-4.0-api.jar:4.0.FR]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) ~[tomcat-servlet-4.0-api.jar:4.0.FR]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-websocket.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.redhat.rhn.frontend.servlets.SystemDetailsMessageFilter.doFilter(SystemDetailsMessageFilter.java:57) ~[rhn.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.redhat.rhn.frontend.servlets.AuthFilter.doFilter(AuthFilter.java:110) ~[rhn.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:142) ~[sitemesh.jar:?]
        at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:58) ~[sitemesh.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.redhat.rhn.frontend.servlets.LocalizedEnvironmentFilter.doFilter(LocalizedEnvironmentFilter.java:71) ~[rhn.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.redhat.rhn.frontend.servlets.EnvironmentFilter.doFilter(EnvironmentFilter.java:99) ~[rhn.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.redhat.rhn.frontend.servlets.SessionFilter.doFilter(SessionFilter.java:59) ~[rhn.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at com.redhat.rhn.frontend.servlets.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:98) ~[rhn.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:179) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:154) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[catalina.jar:9.0.87]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) ~[catalina.jar:9.0.87]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[catalina.jar:9.0.87]
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:670) ~[catalina.jar:9.0.87]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[catalina.jar:9.0.87]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) ~[catalina.jar:9.0.87]
        at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:424) ~[tomcat-coyote.jar:9.0.87]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-coyote.jar:9.0.87]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928) ~[tomcat-coyote.jar:9.0.87]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1786) ~[tomcat-coyote.jar:9.0.87]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-coyote.jar:9.0.87]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-util.jar:9.0.87]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-util.jar:9.0.87]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-util.jar:9.0.87]
        at java.lang.Thread.run(Thread.java:829) ~[?:?]
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: More than one row with the given identifier was found: 2832, for class: com.redhat.rhn.domain.channel.ChannelSyncFlag
        at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1575) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at com.redhat.rhn.common.hibernate.HibernateFactory.listObjectsByNamedQuery(HibernateFactory.java:275) ~[rhn.jar:?]
        at com.redhat.rhn.common.hibernate.HibernateFactory.listObjectsByNamedQuery(HibernateFactory.java:219) ~[rhn.jar:?]
        at com.redhat.rhn.domain.channel.ChannelFactory.getAccessibleChildChannels(ChannelFactory.java:375) ~[rhn.jar:?]
        at com.redhat.rhn.domain.channel.Channel.getAccessibleChildrenFor(Channel.java:798) ~[rhn.jar:?]
        at com.redhat.rhn.manager.distupgrade.DistUpgradeManager.getAlternatives(DistUpgradeManager.java:453) ~[rhn.jar:?]
        at com.redhat.rhn.frontend.action.systems.SPMigrationAction.execute(SPMigrationAction.java:293) ~[rhn.jar:?]
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) ~[struts.jar:1.2.9]
        ... 50 more
Caused by: org.hibernate.HibernateException: More than one row with the given identifier was found: 2832, for class: com.redhat.rhn.domain.channel.ChannelSyncFlag
        at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.extractEntityResult(AbstractLoadPlanBasedEntityLoader.java:254) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:198) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4290) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:604) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:572) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:226) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:350) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:127) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:93) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.internal.SessionImpl.fireLoadNoChecks(SessionImpl.java:1277) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1149) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:682) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.type.EntityType.resolve(EntityType.java:464) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:205) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:160) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1172) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.processResultSet(Loader.java:1022) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.doQuery(Loader.java:960) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:351) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.doList(Loader.java:2787) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.doList(Loader.java:2770) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2604) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.Loader.list(Loader.java:2599) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:2243) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.internal.AbstractSharedSessionContract.list(AbstractSharedSessionContract.java:1069) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.query.internal.NativeQueryImpl.doList(NativeQueryImpl.java:173) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1566) ~[hibernate5_hibernate-core.jar:5.3.25.Final]
        at com.redhat.rhn.common.hibernate.HibernateFactory.listObjectsByNamedQuery(HibernateFactory.java:275) ~[rhn.jar:?]
        at com.redhat.rhn.common.hibernate.HibernateFactory.listObjectsByNamedQuery(HibernateFactory.java:219) ~[rhn.jar:?]
        at com.redhat.rhn.domain.channel.ChannelFactory.getAccessibleChildChannels(ChannelFactory.java:375) ~[rhn.jar:?]
        at com.redhat.rhn.domain.channel.Channel.getAccessibleChildrenFor(Channel.java:798) ~[rhn.jar:?]
        at com.redhat.rhn.manager.distupgrade.DistUpgradeManager.getAlternatives(DistUpgradeManager.java:453) ~[rhn.jar:?]
        at com.redhat.rhn.frontend.action.systems.SPMigrationAction.execute(SPMigrationAction.java:293) ~[rhn.jar:?]
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) ~[struts.jar:1.2.9]
        ... 50 more

Additional information

No response

s0rnix commented 5 months ago

https://github.com/uyuni-project/uyuni/issues/8693 helped.

i have performed this steps:

uyuni:~ # spacewalk-sql --select-mode - <<< "select * from rhnChannelSyncFlag where channel_id = 2832;" > query.out uyuni:~ # cat query.out channel_id | no_strict | no_errata | only_latest | create_tree | quit_on_error ------------+-----------+-----------+-------------+-------------+--------------- 2832 | f | f | f | f | f 2832 | f | f | f | f | f (2 rows)

uyuni:/var/spacewalk # spacewalk-sql --select-mode - <<< "

ALTER TABLE rhnChannelSyncFlag DROP CONSTRAINT IF EXISTS rhn_chsf_cid_pk; ALTER TABLE rhnChannelSyncFlag DROP CONSTRAINT IF EXISTS rhn_chsf_cid_fk;

DELETE FROM rhnChannelSyncFlag T1 USING rhnChannelSyncFlag T2 WHERE T1.ctid < T2.ctid -- delete the "older" ones AND T1.channel_id = T2.channel_id; -- list columns that define duplicates

ALTER TABLE rhnChannelSyncFlag ADD CONSTRAINT rhn_chsf_cid_pk PRIMARY KEY (channel_id); ALTER TABLE rhnChannelSyncFlag ADD CONSTRAINT rhn_chsf_cid_fk FOREIGN KEY (channel_id) REFERENCES rhnChannel(id) ON DELETE CASCADE; " ALTER TABLE ALTER TABLE DELETE 83 ALTER TABLE ALTER TABLE

uyuni:/var/spacewalk # spacewalk-sql --select-mode - <<< "select * from rhnChannelSyncFlag where channel_id = 2832;" channel_id | no_strict | no_errata | only_latest | create_tree | quit_on_error ------------+-----------+-----------+-------------+-------------+--------------- 2832 | f | f | f | f | f (1 row)

rjmateus commented 5 months ago

that would solve the issue. The strange thing is why that happened. How was your installation? Did you upgrade from older version? do you remember which versions?

s0rnix commented 5 months ago

that would solve the issue. The strange thing is why that happened. How was your installation? Did you upgrade from older version? do you remember which versions?

last year a fresh installation from scratch (opensuse) and only run zypper update. last on 06.05.2024