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

java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer #13

Closed
kkrasnov1 opened this issue Oct 1, 2021 · 2 comments

Comments

@kkrasnov1
Copy link

kkrasnov1 commented Oct 1, 2021

Hi,

I am getting the following error when starting the application and refreshing the node:

2021-10-01 11:23:21,887 [CollectorStatusDto-0] DEBUG d.i.m.s.m.MongoDbAccessor:166 - runCommand {"buildInfo": 1} execTime in ms: 18 on [core-hash01.xxxx.qqq:27017]/admin
2021-10-01 11:23:21,888 [CollectorStatusDto-1] ERROR d.i.m.s.c.CollectorManager:641 - ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.xxxx.qqq:27017/wwww-sh-lt
java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)
        at de.idealo.mongodb.slowops.collector.CollectorManager$4.run(CollectorManager.java:630)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
        at org.bson.Document.getInteger(Document.java:243)
        at de.idealo.mongodb.slowops.collector.ProfilingReader.updateHostInfo(ProfilingReader.java:440)
        at de.idealo.mongodb.slowops.collector.CollectorManager$3.run(CollectorManager.java:610)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        ... 3 common frames omitted
2021-10-01 11:23:21,889 [http-nio-8080-exec-3] INFO  d.i.m.s.c.CollectorManager:664 - Waited termination of CollectorStatusDto executorService for 71 ms, isTerminated: true
2021-10-01 11:23:21,891 [http-nio-8080-exec-3] DEBUG d.i.m.s.c.CollectorManager:718 - <<< getApplicationStatus
2021-10-01 11:23:21,892 [http-nio-8080-exec-3] DEBUG d.i.m.s.servlet.Action:80 - getApplicationJSON result:
2021-10-01 11:23:21,894 [http-nio-8080-exec-3] DEBUG d.i.m.s.d.ApplicationStatusDto:43 - getCollectorStatuses size:1
2021-10-01 11:23:21,907 [http-nio-8080-exec-3] DEBUG d.i.m.s.servlet.Action:81 - {
  "collectorStatuses" : [ {
    "instanceId" : 6,
    "label" : "lt02-hash-dbs",
    "replSetName" : "wwww-lt01-hash",
    "database" : "wwww-sh-lt",
    "collections" : [ "*" ],
    "slowMs" : 250,
    "systemProfileMaxSizeInBytes" : 0,
    "replSetStatus" : "PRIMARY",
    "doneJobsHistory" : [ 0, 0, 0, 0, 0, 0, 0, 0 ],
    "cpuArch" : "x86_64",
    "numCores" : 64,
    "cpuFreqMHz" : 800,
    "memSizeMB" : 0,
    "mongodbVersion" : null,
    "lastTsFormatted" : "",
    "collecting" : true,
    "collectionsAsString" : "*",
    "serverAddressAsString" : "core-hash01.xxxx.qqq:27017",
    "profiling" : false
  } ],
  "collectorServerDto" : {
    "hosts" : [ {
      "host" : "mongo1.qqq",
      "port" : 27017,
      "socketAddress" : {
        "hostString" : "mongo1.qqq",
        "address" : "mongo1.qqq",
        "port" : 27017,
        "unresolved" : false,
        "hostName" : "mongo1.qqq"
      },
      "socketAddresses" : [ {
        "hostString" : "mongo1.qqq",
        "address" : "mongo1.qqq",
        "port" : 27017,
        "unresolved" : false,
        "hostName" : "mongo1.qqq"
      } ]
    } ],
    "db" : "mongodba",
    "collection" : "slowops",
    "adminUser" : "",
    "adminPw" : "",
    "ssl" : false
  },
  "collectorRunningSince" : 1633076310478,
  "numberOfReads" : 0,
  "numberOfWrites" : 0,
  "numberOfReadsOfRemovedReaders" : 0,
  "numberOfWritesOfRemovedWriters" : 0,
  "config" : null,
  "lastRefresh" : 1633076601891,
  "webLog" : "2021/10/01 11:20:19,410 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash03.prod02.wwww.qqq:27017/wwww-sh-lt\n2021/10/01 11:20:19,505 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.prod02.wwww.qqq:27017/wwww-sh-lt\n2021/10/01 11:20:19,509 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash02.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:20:19,512 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash02.prod02.wwww.qqq:27017/wwww-sh-lt\n2021/10/01 11:20:21,221 TimeoutException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash03.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:20:21,226 Pool of max. 13 threads to get updated server status is going to be closed after max. response timeout of 2000 ms although not all threads have terminated. Add CPU cores or increment response timeout to solve the issue.\n2021/10/01 11:20:21,236 InterruptedException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:07,743 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash02.prod02.wwww.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:07,745 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash03.prod02.wwww.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:07,748 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.prod02.wwww.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:07,764 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash02.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:07,851 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:07,851 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash03.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:21:14,974 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.xxxx.qqq:27017/wwww-sh-lt\n2021/10/01 11:23:21,888 ExecutionException while getting updated server status within 2000 ms for 'lt02-hash-dbs' at core-hash01.xxxx.qqq:27017/wwww-sh-lt\n"
}
2021-10-01 11:23:21,908 [http-nio-8080-exec-3] INFO  d.i.m.s.servlet.Action:91 - <<< getApplicationJSON
2021-10-01 11:23:21,908 [http-nio-8080-exec-3] DEBUG d.i.m.s.d.ApplicationStatusDto:43 - getCollectorStatuses size:1


My MongoDB version is 4.4.8.

Maybe the reason "memSizeMB" : NumberLong(772652) for this?

db.runCommand( { hostInfo: 1 } )
{
        "system" : {
                "currentTime" : ISODate("2021-10-01T10:51:54.950Z"),
                "hostname" : "core-hash01",
                "cpuAddrSize" : 64,
                "memSizeMB" : NumberLong(772652),
                "memLimitMB" : NumberLong(772652),
                "numCores" : 64,
                "cpuArch" : "x86_64",
                "numaEnabled" : false
        },

In ProfilingReader i made the following changes and the error disappeared:

hostInfoDto.setMemSizeMB(111);

Now I am getting the following error in other actions:

2021-10-01 14:33:10,664 [TableDto-0] DEBUG d.i.m.s.m.MongoDbAccessor:166 - runCommand {"hostInfo": 1} execTime in ms: 37 on [core-hash01.xxxx:27017]/admin
2021-10-01 14:33:10,665 [TableDto-0] DEBUG o.m.d.protocol.command:56 - Sending command '{"dbStats": 1, "$db": "wwww-sh-lt", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1633087987, "i": 2}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}, "lsid": {"id": {"$binary": {"base64": "ofrsFWMVQgmknJor+F1a2w==", "subType": "04"}}}, "$readPreference": {"mode": "primaryPreferred"}}' with request id 2607 to database wwww-sh-lt on connection [connectionId{localValue:27, serverValue:19519}] to server core-hash01.xxxx:27017
2021-10-01 14:33:10,682 [TableDto-0] DEBUG o.m.d.protocol.command:56 - Execution of command with request id 2607 completed successfully in 17.56 ms on connection [connectionId{localValue:27, serverValue:19519}] to server core-hash01.xxxx:27017
2021-10-01 14:33:10,683 [TableDto-0] WARN  d.i.m.s.c.CmdDatabaseStats:81 - Exception while running command
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
        at org.bson.Document.getInteger(Document.java:243)
        at de.idealo.mongodb.slowops.command.CmdDatabaseStats.runCommand(CmdDatabaseStats.java:72)
        at de.idealo.mongodb.slowops.command.CommandExecutor.call(CommandExecutor.java:36)
        at de.idealo.mongodb.slowops.command.CommandExecutor.call(CommandExecutor.java:16)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
2021-10-01 14:33:10,683 [http-nio-8080-exec-9] DEBUG d.i.m.s.s.CommandResult:88 - doGet
2021-10-01 14:33:10,685 [http-nio-8080-exec-9] DEBUG d.i.m.s.s.CommandResult:90 - <<< doGet
@kagahd
Copy link
Collaborator

kagahd commented Oct 5, 2021

@kkrasnov1 , thank you for the bug report!
I just released a new version (3.1.6) which fixes this issue.

@kagahd kagahd closed this as completed Oct 5, 2021
@kkrasnov1
Copy link
Author

@kkrasnov1 , thank you for the bug report! I just released a new version (3.1.6) which fixes this issue.

Thank you!

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

No branches or pull requests

2 participants