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

Subscribe to feed, java.sql.BatchUpdateException Incorrect datetime value: '1970-01-01 00:00:00' for column rss.FEEDS.disabledUntil at row 1 #1239

Closed
test-in-prod opened this issue Feb 9, 2024 · 7 comments
Labels

Comments

@test-in-prod
Copy link

test-in-prod commented Feb 9, 2024

Describe the bug
When attempting to subscribe to a feed via the web UI (page with the Subscribe button), I get the following error message:

There was an error processing your request. It has been logged (ID b43675446d12f00e).

Looking at the logs, I see the following:

Feb 09 07:18:39 rss java[4027]: ERROR [2024-02-09 15:18:39,044] org.hibernate.engine.jdbc.batch.internal.BatchingBatch: HHH000315: Exception executing batch [java.sql.BatchUpdateException: Data truncation: Incorrect datetime value: '1970-01-01 00:00:00' for column `rss`.`FEEDS`.`disabledUntil` at row 1], SQL: /* insert com.commafeed.backend.model.Feed */ insert into FEEDS (averageEntryInterval, disabledUntil, errorCount, etagHeader, lastContentHash, lastEntryDate, lastModifiedHeader, lastPublishedDate, lastUpdated, link, message, normalizedUrl, normalizedUrlHash, url, url_after_redirect, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Feb 09 07:18:39 rss java[4027]: WARN  [2024-02-09 15:18:39,045] org.hibernate.engine.jdbc.spi.SqlExceptionHelper: SQL Error: 1292, SQLState: 22001
Feb 09 07:18:39 rss java[4027]: ERROR [2024-02-09 15:18:39,045] org.hibernate.engine.jdbc.spi.SqlExceptionHelper: Data truncation: Incorrect datetime value: '1970-01-01 00:00:00' for column `rss`.`FEEDS`.`disabledUntil` at row 1
Feb 09 07:18:39 rss java[4027]: ERROR [2024-02-09 15:18:39,047] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: b43675446d12f00e
Feb 09 07:18:39 rss java[4027]: ! com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: '1970-01-01 00:00:00' for column `rss`.`FEEDS`.`disabledUntil` at row 1
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:104)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:912)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1054)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1003)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1312)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchWithMultiValuesClause(ClientPreparedStatement.java:677)
Feb 09 07:18:39 rss java[4027]: ! ... 107 common frames omitted
Feb 09 07:18:39 rss java[4027]: ! Causing: java.sql.BatchUpdateException: Data truncation: Incorrect datetime value: '1970-01-01 00:00:00' for column `rss`.`FEEDS`.`disabledUntil` at row 1
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.exceptions.SQLError.createBatchUpdateException(SQLError.java:223)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchWithMultiValuesClause(ClientPreparedStatement.java:716)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:407)
Feb 09 07:18:39 rss java[4027]: ! at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:799)
Feb 09 07:18:39 rss java[4027]: ! at jdk.internal.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
Feb 09 07:18:39 rss java[4027]: ! at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Feb 09 07:18:39 rss java[4027]: ! at java.base/java.lang.reflect.Method.invoke(Method.java:568)
Feb 09 07:18:39 rss java[4027]: ! at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
Feb 09 07:18:39 rss java[4027]: ! at jdk.proxy2/jdk.proxy2.$Proxy111.executeBatch(Unknown Source)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:123)
Feb 09 07:18:39 rss java[4027]: ! ... 99 common frames omitted
Feb 09 07:18:39 rss java[4027]: ! Causing: org.hibernate.exception.DataException: could not execute batch
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:101)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:133)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:108)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:153)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.getBatch(JdbcCoordinatorImpl.java:182)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3418)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:4073)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:103)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:612)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:483)
Feb 09 07:18:39 rss java[4027]: ! at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:480)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:329)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1425)
Feb 09 07:18:39 rss java[4027]: ! ... 85 common frames omitted
Feb 09 07:18:39 rss java[4027]: ! Causing: jakarta.persistence.PersistenceException: Converting `org.hibernate.exception.DataException` to JPA `PersistenceException` : could not execute batch
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:165)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:175)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:182)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1429)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:477)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2234)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:1930)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:439)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
Feb 09 07:18:39 rss java[4027]: ! at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.hibernate.UnitOfWorkAspect.commitTransaction(UnitOfWorkAspect.java:212)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.hibernate.UnitOfWorkAspect.afterEnd(UnitOfWorkAspect.java:113)
Feb 09 07:18:39 rss java[4027]: ! at java.base/java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4780)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.hibernate.UnitOfWorkApplicationListener$UnitOfWorkEventListener.onEvent(UnitOfWorkApplicationListener.java:93)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.internal.monitoring.CompositeRequestEventListener.onEvent(CompositeRequestEventListener.java:47)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.internal.process.RequestProcessingContext.triggerEvent(RequestProcessingContext.java:203)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ContainerFilteringStage$ResponseFilterStage.apply(ContainerFilteringStage.java:164)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ContainerFilteringStage$ResponseFilterStage.apply(ContainerFilteringStage.java:139)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.process.internal.Stages.process(Stages.java:147)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:378)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:370)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:358)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)
Feb 09 07:18:39 rss java[4027]: ! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:36)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:46)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:40)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.servlets.CacheBustingFilter.doFilter(CacheBustingFilter.java:27)
Feb 09 07:18:39 rss java[4027]: ! at com.commafeed.CommaFeedApplication$5.doFilter(CommaFeedApplication.java:239)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.metrics.jetty11.InstrumentedHandler.handle(InstrumentedHandler.java:310)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:52)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:822)
Feb 09 07:18:39 rss java[4027]: ! at io.dropwizard.jetty.ZipExceptionHandlingGzipHandler.handle(ZipExceptionHandlingGzipHandler.java:26)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:46)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:173)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.Server.handle(Server.java:563)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
Feb 09 07:18:39 rss java[4027]: ! at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
Feb 09 07:18:39 rss java[4027]: ! at java.base/java.lang.Thread.run(Thread.java:840)

Environment (please complete the following information):

  • CommaFeed version (or "commafeed.com"): 4.2.1 (b82077d)
  • Browser [e.g. chrome, firefox]: Firefox
  • Device [e.g. desktop, mobile]: Desktop
  • OS: Debian Bookworm 12
  • DB: MariaDB
@Athou Athou added the bug label Feb 9, 2024
@Athou
Copy link
Owner

Athou commented Feb 9, 2024

Thanks, I can confirm there's an issue, mysql/mariadb TIMESTAMP column seems to start at 1970-01-01 00:00:01 so it can't store 1970-01-01 00:00:00. I'll release a fix ASAP.

@Athou
Copy link
Owner

Athou commented Feb 9, 2024

I just released 4.3.0 that should fix this.

@Athou Athou closed this as completed Feb 9, 2024
@test-in-prod
Copy link
Author

Awesome. Updated and confirmed this is resolved ❤️

@tari
Copy link

tari commented Feb 9, 2024

The adjusted time still causes problems on my system using MariaDB 10.11.6 and commafeed 4.3.0:

WARN  [2024-02-09 22:39:29,459] org.mariadb.jdbc.message.server.ErrorPacket: Error: 1292-22007: Incorrect datetime value: '1970-01-01 00:00:01' for column `commafeed`.`FEEDS`.`disabledUntil` at row 1
ERROR [2024-02-09 22:39:29,463] org.hibernate.engine.jdbc.batch.internal.BatchingBatch: HHH000315: Exception executing batch [java.sql.BatchUpdateException: (conn=9025) Incorrect datetime value: '1970-01-01 00:00:01' for column `commafeed`.`FEEDS`.`disabledUntil` at row 1], SQL: /* insert com.commafeed.backend.model.Feed */ insert into FEEDS (averageEntryInterval, disabledUntil, errorCount, etagHeader, lastContentHash, lastEntryDate, lastModifiedHeader, lastPublishedDate, lastUpdated, link, message, normalizedUrl, normalizedUrlHash, url, url_after_redirect, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
WARN  [2024-02-09 22:39:29,477] org.hibernate.engine.jdbc.spi.SqlExceptionHelper: SQL Error: 1292, SQLState: 22007
ERROR [2024-02-09 22:39:29,478] org.hibernate.engine.jdbc.spi.SqlExceptionHelper: (conn=9025) Incorrect datetime value: '1970-01-01 00:00:01' for column `commafeed`.`FEEDS`.`disabledUntil` at row 1

I believe this is timezone-related, because MariaDB's TIMESTAMP type is documented to store the value as UTC, so early on 1970-01-01 in the UTC+11 timezone (which my system is currently in) gets converted to sometime on 1969-12-31 UTC which is an invalid timestamp.

The largest positive UTC offset in use is UTC+14, so the earliest timestamp that's safe to use in all time zones is 1970-01-01 14:00:01. It might be a little nicer (but probably not portable to other databases) to use a DATETIME column instead, since it supports a wider range than TIMESTAMP.

@tari
Copy link

tari commented Feb 10, 2024

As a temporary hack, setting my MariaDB time zone to UTC does fix the issue: SET GLOBAL time_zone = '+00:00';, then restarting commafeed (to make it reconnect to the database) makes the problem go away.

@Athou
Copy link
Owner

Athou commented Feb 10, 2024

I read the documentation of MariaDB (https://mariadb.com/kb/en/about-mariadb-connector-j/#timezone-consideration) and here's what I understand:
When a timestamp needs to be stored, MariaDB takes the timestamp supplied by CommaFeed (which is in UTC) but thinks it's in the timezone it's running in.
So it converts it to UTC and stores it. When the timestamps needs to be retrieved, the conversion is applied the other way around and everything appears to work correctly in the UI. The stored timestamp however is actually not correct in the database, it has an offset.

This is why the "Data truncation" error occurs, CommaFeed tries to set the disabledUntil field to 1970-01-01 00:00:01" but MariaDB applies an offset and the timestamp is now in an invalid range for the field.

I think this is what needs to change:

  • "&timezone=UTC" should be added in the JDBC connection string in config.yml.example. This will make MariaDB store timestamps as supplied without conversion.
  • The timestamp set to the disabledUntil field in the database when a new feed is added should be 1970-01-01 + 1 day so that it works in all timezones, for people that haven't added the timezone connection string parameter yet.

@Athou Athou reopened this Feb 10, 2024
@tari
Copy link

tari commented Feb 10, 2024

Those changes seem okay to me; I've set the timezone in my database URL and that appears to behave nicely, but also adjusting the minimum time to not fail on databases which are configured differently from expected would be nice.

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

No branches or pull requests

3 participants