Statistics App not working properly

Hello everyone,

the statistic app fails to properly track visits to our XWiki.

This is what I could get from logs:

2017-09-11 14:50:01,851 [Statistics storing daemon] WARN  o.h.u.JDBCExceptionReporter    - SQL Error: 8115, SQLState: S0002 
2017-09-11 14:50:01,851 [Statistics storing daemon] ERROR o.h.u.JDBCExceptionReporter    - Arithmetischer Überlauffehler beim Konvertieren von expression in den int-Datentyp. 
2017-09-11 14:50:01,851 [Statistics storing daemon] ERROR .x.x.s.i.x.VisitStatsStoreItem - Failed to save visit statistics object [class com.xpn.xwiki.stats.impl.xwiki.VisitStatsStoreItem XWiki.XWikiGuest 183.178.3.146Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0 ORCONJ0ATJGKLCVX3BZYN3BIQWSZEUVF] 
com.xpn.xwiki.XWikiException: Error number 3211 in 3: Exception while saving object XWiki.XWikiGuest
	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:1260)
	at com.xpn.xwiki.stats.impl.xwiki.VisitStatsStoreItem.storeInternal(VisitStatsStoreItem.java:102)
	at com.xpn.xwiki.stats.impl.xwiki.AbstractStatsStoreItem.store(AbstractStatsStoreItem.java:93)
	at com.xpn.xwiki.stats.impl.xwiki.XWikiStatsStoreService.register(XWikiStatsStoreService.java:172)
	at com.xpn.xwiki.stats.impl.xwiki.XWikiStatsStoreService.runInternal(XWikiStatsStoreService.java:124)
	at com.xpn.xwiki.util.AbstractXWikiRunnable.run(AbstractXWikiRunnable.java:133)
	at java.lang.Thread.run(Thread.java:748)

Caused by: org.hibernate.HibernateException: Failed to commit or rollback transaction. Root cause []
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:1056)
	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:1254)
	... 6 common frames omitted

Caused by: org.hibernate.exception.SQLGrammarException: could not insert: [com.xpn.xwiki.stats.impl.VisitStats]
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2454)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2874)
	at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:1048)
	... 7 common frames omitted

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Arithmetischer Überlauffehler beim Konvertieren von expression in den int-Datentyp.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:440)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:385)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:328)
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
	at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:46)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2434)
	... 18 common frames omitted

There exists an oddly familiar-sounding issue, but it should be fixed:

https://jira.xwiki.org/browse/XWIKI-8937

I’m running XWiki 9.6

Any ideas?

Thanks,
Pako

Hi,

Note that Microsoft SQL server is not supported (See http://dev.xwiki.org/xwiki/bin/view/Community/DatabaseSupportStrategy) and it seems there’s some SQL that it doesn’t like.

Does it work if you try it on another DB?

Since nobody from the xwiki dev team uses MSSQL, it would be great if you could send a patch/Pul Request and we’ll gladly apply it.

Thanks

Thanks for the quick reply.

I opened an issue: Loading...

However, I will consider migration to MySQL/PostgreSQL in the long run.

Thanks. I couldn’t find where your Pull Request is in the issue :slight_smile: Maybe you forgot to reference it?

Hi Vincent,

after talking it through with a colleague we decided that it is not worth the effort.

Since there probably will be a lot more issues with MS SQL in the future, we rather migrate on to another DB.

You can close the issue as WONTFIX. It’s just for documentation then.

Thanks.

Ok thanks for posting back @Pako !