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 while trying to sell more than 32767 stocks #2343

Closed
MrPowerGamerBR opened this issue Jan 12, 2021 · 0 comments
Closed

Bug while trying to sell more than 32767 stocks #2343

MrPowerGamerBR opened this issue Jan 12, 2021 · 0 comments

Comments

@MrPowerGamerBR
Copy link
Member

MrPowerGamerBR commented Jan 12, 2021

pgjdbc/pgjdbc#1311

Seems like we need to split up the deletion into 32767 chunks to avoid this issue

Exception ao executar comando BrokerSellStockCommand
org.jetbrains.exposed.exceptions.ExposedSQLException: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
	at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:63)
	at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:129)
	at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:115)
	at org.jetbrains.exposed.sql.statements.Statement.execute(Statement.kt:29)
	at org.jetbrains.exposed.sql.statements.DeleteStatement$Companion.where(DeleteStatement.kt:22)
	at org.jetbrains.exposed.sql.QueriesKt.deleteWhere(Queries.kt:57)
	at org.jetbrains.exposed.sql.QueriesKt.deleteWhere$default(Queries.kt:56)
	at net.perfectdreams.loritta.plugin.loribroker.commands.BrokerSellStockCommand$command$1$2$invokeSuspend$$inlined$withLock$lambda$3.invoke(BrokerSellStockCommand.kt:103)
	at net.perfectdreams.loritta.plugin.loribroker.commands.BrokerSellStockCommand$command$1$2$invokeSuspend$$inlined$withLock$lambda$3.invoke(BrokerSellStockCommand.kt:23)
	at net.perfectdreams.loritta.platform.discord.LorittaDiscord$newSuspendedTransaction$2$1.invoke(LorittaDiscord.kt:567)
	at net.perfectdreams.loritta.platform.discord.LorittaDiscord$newSuspendedTransaction$2$1.invoke(LorittaDiscord.kt:62)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$inTopLevelTransaction$1.invoke(ThreadLocalTransactionManager.kt:170)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$inTopLevelTransaction$2.invoke(ThreadLocalTransactionManager.kt:211)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:219)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.inTopLevelTransaction(ThreadLocalTransactionManager.kt:210)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$transaction$1.invoke(ThreadLocalTransactionManager.kt:148)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:219)
	at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:120)
	at net.perfectdreams.loritta.platform.discord.LorittaDiscord$newSuspendedTransaction$2.invokeSuspend(LorittaDiscord.kt:566)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:350)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
	at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
	at org.jetbrains.exposed.sql.statements.jdbc.JdbcPreparedStatementImpl.executeUpdate(JdbcPreparedStatementImpl.kt:23)
	at org.jetbrains.exposed.sql.statements.DeleteStatement.executeInternal(DeleteStatement.kt:9)
	at org.jetbrains.exposed.sql.statements.DeleteStatement.executeInternal(DeleteStatement.kt:6)
	at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:61)
	... 24 common frames omitted
Caused by: java.io.IOException: Tried to send an out-of-range integer as a 2-byte value: 50000
	at org.postgresql.core.PGStream.sendInteger2(PGStream.java:347)
	at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:1547)
	at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1872)
	at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1433)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:315)
	... 34 common frames omitted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant