Expired sessions still on the User session screen

Hi,
I was just wondering if this issue has come back somehow?
My app is on 6.8.4 and I am still seeing even two weeks old, expired sessions…
Is there a way to evict them by calling some function?
image

Thanks
Gabor

Hi,
The issue is fixed in 6.8.3. In newer versions, everything should work well.
At first, please ensure the application was correctly deployed and the new version of platform is used. Open Help->About and look which version has the CUBA Application Component.
image

Have you modified UserSessions settings?

  1. Open Admininstration-JMX Console.
  2. Expand “app-core.cuba”.
  3. And open the “app-core.cuba:type=UserSessions” bean.
  4. Check ExpirationTimeoutSec
  5. Invoke processEviction()
  6. Invoke printSessions()

Are the old sessions still there?
image

Hi Rostislav,
thank you for helping me with this issue. I can confirm, it’s on 6.8.4:
image

However, I don’t have app-core.cuba branch in JMX console, just .cuba

The settings seem to be unmodified:
image

for both middlewares.

Invoking processEviction() and printSessions() show that they are still there:

> id=467a0899-fc09-5eda-6622-caa561bd640f, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Wed Apr 25 15:30:47 UTC 2018
> id=71012e0c-b1f2-526f-0875-5914b168af92, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Sun Apr 29 14:52:26 UTC 2018
> id=63c885dc-5ab6-44d9-c145-4bc04620ebd2, login=restuser, user=Rest User, since=Fri May 04 13:17:28 UTC 2018, last=Fri May 04 13:17:28 UTC 2018
> id=b81cd6fc-ce67-912d-778c-f502bd25710e, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Tue Apr 24 05:07:38 UTC 2018
> id=aefb5846-b506-027b-b16e-ede32c047259, login=restuser, user=Rest User, since=Fri May 04 12:54:11 UTC 2018, last=Fri May 04 12:54:11 UTC 2018
> id=089254a2-b53f-411d-4105-8102e8dff0db, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Mon Apr 30 06:59:21 UTC 2018
> id=544fdff7-5747-43a8-0e74-11ed2b555c8a, login=admin, user=Administrator, since=Fri May 04 13:09:51 UTC 2018, last=Fri May 04 13:22:07 UTC 2018
> id=b0ef485b-76ae-8888-0b64-83e851b141bd, login=admin, user=Administrator, since=Fri Apr 20 18:55:17 UTC 2018, last=Fri Apr 20 18:55:17 UTC 2018
> id=03829d43-779b-0811-448a-6a6d91d0bb6a, login=admin, user=Administrator, since=Mon Apr 30 06:59:17 UTC 2018, last=Mon Apr 30 07:01:18 UTC 2018
> id=6a575378-a38f-5cc0-8e84-dd28da3401e3, login=admin, user=Administrator, since=Tue May 01 05:07:05 UTC 2018, last=Tue May 01 05:07:05 UTC 2018
> id=3ad9ded4-d81d-793a-c093-d292ae75bf45, login=chris.abbott, user=Chris Abbott, since=Fri May 04 12:56:50 UTC 2018, last=Fri May 04 13:21:47 UTC 2018
> id=807f6a23-461e-f051-222e-0f04552b870f, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Mon Apr 30 07:02:10 UTC 2018
> id=247a0091-3f90-fdfa-5a37-a3b395cfbfd4, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Sun Apr 29 14:52:25 UTC 2018
> id=7885a32b-ab2f-ed75-8380-2771d3f980df, login=admin, user=Administrator, since=Tue Apr 24 05:03:08 UTC 2018, last=Tue Apr 24 05:03:08 UTC 2018
> id=9a91c139-0455-5ff6-6bbc-fc0efdebc571, login=anon, user=Sheridan Leech, since=Wed May 02 10:18:40 UTC 2018, last=Fri May 04 13:20:52 UTC 2018
> id=b8a1ca87-418f-dfef-97a8-a5b48ec409bb, login=admin, user=Administrator, since=Tue May 01 05:03:06 UTC 2018, last=Tue May 01 05:06:10 UTC 2018
> id=45feb39f-70cd-2e30-8d62-2fb24551813b, login=admin, user=Administrator, since=Fri Apr 20 18:55:17 UTC 2018, last=Fri Apr 20 18:55:17 UTC 2018
> id=428e743b-1fa7-aa81-d2e6-e4a14778848b, login=admin, user=Administrator, since=Fri Apr 20 18:55:18 UTC 2018, last=Tue Apr 24 05:03:23 UTC 2018
> id=6dc3b20c-4f47-4a6a-eeaf-5ce05bc87357, login=admin, user=Administrator, since=Fri Apr 20 18:55:17 UTC 2018, last=Tue Apr 24 05:03:22 UTC 2018
> id=36c07088-0e37-a099-c55e-6bccdf8419c2, login=sam, user=Sam Stephens, since=Fri May 04 07:26:07 UTC 2018, last=Fri May 04 13:22:07 UTC 2018
> id=ca2fcc94-daa4-34c1-7884-b02274cc6787, login=admin, user=Administrator, since=Tue May 01 05:07:04 UTC 2018, last=Tue May 01 08:11:04 UTC 2018
> id=2726b759-3330-2a62-7372-58f86807f096, login=admin, user=Administrator, since=Tue May 01 05:03:06 UTC 2018, last=Tue May 01 05:03:06 UTC 2018
> id=f6e1d0af-9036-833b-6490-2019a6876a74, login=admin, user=Administrator, since=Fri Apr 20 18:53:57 UTC 2018, last=Fri Apr 20 18:53:57 UTC 2018
> id=1151ab98-07b3-6346-f7eb-8311522cc0d3, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Mon Apr 30 07:02:09 UTC 2018
> id=a2ff3c67-0c48-0111-f162-ff03af673efd, login=peter.hughes@hotmail.co.uk, user=Peter Hughes, since=Fri May 04 09:14:27 UTC 2018, last=Fri May 04 09:14:27 UTC 2018
> id=048a88de-af90-bd90-3630-192b64608512, login=admin, user=Administrator, since=Tue May 01 05:07:05 UTC 2018, last=Tue May 01 08:11:01 UTC 2018
> id=e70cf74f-f1cd-963d-101c-6b84e9f3ae99, login=admin, user=Administrator, since=Tue May 01 08:10:40 UTC 2018, last=Tue May 01 08:10:40 UTC 2018
> id=d156acf0-f954-0d02-f6c9-566e2ace9dda, login=restuser, user=Rest User, since=Fri May 04 10:41:41 UTC 2018, last=Fri May 04 13:21:19 UTC 2018
> id=703f626b-934b-a69a-5c2e-dd2ef3b71979, login=restuser, user=Rest User, since=Fri May 04 12:40:09 UTC 2018, last=Fri May 04 12:59:04 UTC 2018
> id=4af1d445-f637-d4ed-3682-2d54055551a3, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Wed Apr 25 06:24:33 UTC 2018
> id=79f7d4b3-284e-a3f9-2174-9e19816af9a0, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Mon Apr 30 07:02:09 UTC 2018
> id=087d9ece-7dc2-db63-36f9-1bf840883ecd, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Sun Apr 29 14:52:25 UTC 2018
> id=aed40fc1-7a99-cb68-2575-f43e6ec5853c, login=admin, user=Administrator, since=Tue May 01 05:07:05 UTC 2018, last=Tue May 01 05:07:06 UTC 2018
> id=32210fd6-b2c7-35df-47f5-67d9f77f46eb, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Tue Apr 24 05:07:36 UTC 2018
> id=fe760e64-f934-cd8e-7c84-fd4bb1189122, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Thu Apr 26 06:39:24 UTC 2018
> id=240d6eac-181f-299f-7781-9250558dbf23, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 08:14:15 UTC 2018
> id=0f312e5b-b48f-ba5d-490a-3bdb5f136024, login=marta, user=Marta Caricato, since=Fri May 04 08:13:28 UTC 2018, last=Fri May 04 13:22:05 UTC 2018
> id=bcb3d41e-440d-4142-25ae-67e6d9e1e814, login=mark, user=Mark Churchill, since=Fri May 04 09:34:18 UTC 2018, last=Fri May 04 13:22:09 UTC 2018
> id=25e1099e-9a0c-640f-f275-1442fa65064e, login=ruth, user=Ruth Richards, since=Fri May 04 10:58:25 UTC 2018, last=Fri May 04 13:22:00 UTC 2018
> id=cc8cf777-f749-1bc5-9954-e31d92689337, login=anon, user=Sheridan Leech, since=Fri May 04 12:39:53 UTC 2018, last=Fri May 04 13:22:07 UTC 2018
> id=167b81ce-b70a-eb48-fdcd-7a3820b3f0d0, login=restuser, user=Rest User, since=Fri May 04 12:53:54 UTC 2018, last=Fri May 04 12:53:54 UTC 2018
> id=c99854df-f913-0fe8-bf44-cab094b3fa9f, login=lois, user=Lois Townsend, since=Fri May 04 07:30:40 UTC 2018, last=Fri May 04 13:22:09 UTC 2018
> id=ecb2dd2f-b9bf-beb1-f61b-b7d3a97d9242, login=ellie, user=Ellie Sawkins, since=Fri May 04 07:40:19 UTC 2018, last=Fri May 04 13:22:07 UTC 2018
> id=f5bf2069-b358-7d55-6f2e-9a85c06b947d, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 08:14:16 UTC 2018
> id=82fe3d00-1f00-6b7f-0c6d-2a8e70dea3cf, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Mon Apr 30 07:02:09 UTC 2018
> id=438c701a-b056-2ab6-d9d6-815543ef7d61, login=admin, user=Administrator, since=Tue Apr 24 05:03:08 UTC 2018, last=Tue Apr 24 05:07:13 UTC 2018
> id=071027f3-57ff-f0ad-5927-fb03cc77819d, login=admin, user=Administrator, since=Tue May 01 05:07:05 UTC 2018, last=Tue May 01 05:07:05 UTC 2018
> id=ca380daa-dc5d-7b55-fc60-3e1a682d9149, login=restuser, user=Rest User, since=Fri May 04 12:54:12 UTC 2018, last=Fri May 04 12:54:12 UTC 2018
> id=599cbfd6-25c5-1e1d-a7df-3f77e6f50a4a, login=admin, user=Administrator, since=Mon Apr 30 07:02:08 UTC 2018, last=Tue May 01 05:03:30 UTC 2018
> id=50ef7c76-dfef-1bb1-ded8-2d19e8587ddb, login=admin, user=Administrator, since=Tue May 01 05:07:05 UTC 2018, last=Tue May 01 05:07:05 UTC 2018
> id=6adacbbf-4d41-496a-2198-7ebfa1342ad0, login=admin, user=Administrator, since=Mon Apr 30 06:59:17 UTC 2018, last=Mon Apr 30 07:01:36 UTC 2018
> id=13cbb079-901a-e396-5634-e613023bc9ad, login=admin, user=Administrator, since=Tue May 01 05:03:06 UTC 2018, last=Tue May 01 05:06:32 UTC 2018
> id=8eacd4da-edc7-76e9-2113-63c4b287609c, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 08:14:16 UTC 2018
> id=be844864-b710-be01-4fb5-dc438401b793, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Wed Apr 25 15:30:47 UTC 2018
> id=01e5d358-2b88-3735-29c2-3db643d93f38, login=demo, user=Demo User, since=Fri May 04 13:15:52 UTC 2018, last=Fri May 04 13:15:52 UTC 2018
> id=1035f694-8260-30ac-c464-ab5d3fa6a165, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 10:07:19 UTC 2018
> id=9f51fa67-afbc-b53b-6754-25d8cda43801, login=admin, user=Administrator, since=Wed Apr 25 06:24:23 UTC 2018, last=Wed Apr 25 15:30:09 UTC 2018
> id=2479b914-6340-e20e-93dc-3cc025d86e7c, login=admin, user=Administrator, since=Thu Apr 26 06:39:07 UTC 2018, last=Thu Apr 26 06:39:07 UTC 2018
> id=14c84adf-4e9a-2bfa-08e3-27a494792ed5, login=restuser, user=Rest User, since=Fri May 04 13:00:12 UTC 2018, last=Fri May 04 13:00:12 UTC 2018
> id=65315954-8f4f-088c-2b9d-003963e33f42, login=poppy, user=Poppy Kent-Greswell, since=Fri May 04 11:24:13 UTC 2018, last=Fri May 04 13:21:55 UTC 2018
> id=6a128ae7-b4ab-c8ac-5687-a4a56c1f1a6b, login=admin, user=Administrator, since=Fri Apr 20 18:55:18 UTC 2018, last=Fri Apr 20 18:55:19 UTC 2018
> id=03b00f17-e1f7-e6b3-6417-076107509061, login=restuser, user=Rest User, since=Fri May 04 12:54:10 UTC 2018, last=Fri May 04 12:54:10 UTC 2018
> id=a9a8545a-9209-de7f-5d27-a30acac768c8, login=restuser, user=Rest User, since=Fri May 04 12:59:25 UTC 2018, last=Fri May 04 12:59:29 UTC 2018
> id=adbfee10-0b10-95dd-4865-7f4437bbc550, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Sun Apr 29 14:52:25 UTC 2018
> id=c939072d-19d6-156b-25c8-4c2599b52459, login=restuser, user=Rest User, since=Fri May 04 12:54:04 UTC 2018, last=Fri May 04 12:54:04 UTC 2018
> id=b8f7c4ff-3cb9-52dd-13ce-0562db61190b, login=restuser, user=Rest User, since=Fri May 04 12:54:10 UTC 2018, last=Fri May 04 12:54:10 UTC 2018
> id=6aff4049-7e14-e8cc-f258-3bf44d7e7110, login=admin, user=Administrator, since=Fri Apr 20 18:53:57 UTC 2018, last=Fri Apr 20 18:55:00 UTC 2018
> id=1700eb86-44af-cd2f-2cb8-7bb278edd34c, login=admin, user=Administrator, since=Fri Apr 20 18:55:17 UTC 2018, last=Fri Apr 20 18:55:19 UTC 2018
> id=665f3f28-fb74-e439-159d-439d6417ab9d, login=restuser, user=Rest User, since=Fri May 04 12:54:11 UTC 2018, last=Fri May 04 12:54:11 UTC 2018
> id=abe29e71-afd6-bfa1-69c6-63ebac10d868, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Tue Apr 24 05:07:36 UTC 2018
> id=6ea3c73c-d466-2d48-4a63-39270c1ae15d, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 08:14:15 UTC 2018
> id=56a322ce-ea71-f723-4b0e-ea71e0cdb33f, login=admin, user=Administrator, since=Tue May 01 10:07:15 UTC 2018, last=Tue May 01 10:07:15 UTC 2018
> id=e8671072-89ce-15bb-5e1c-5318efa76577, login=restuser, user=Rest User, since=Fri May 04 12:54:12 UTC 2018, last=Fri May 04 12:54:12 UTC 2018
> id=35831717-7b60-e66c-fa4d-22b91f524c89, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Tue May 01 05:03:26 UTC 2018
> id=d397e79b-ee26-81f5-c705-497665adf0ba, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 10:07:40 UTC 2018
> id=115e8375-987b-f921-7826-11ea0036ad37, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Wed Apr 25 15:30:47 UTC 2018
> id=3cf359a1-8d63-87d8-386c-bc1715291a06, login=jack, user=Jack Ellison, since=Wed May 02 15:31:47 UTC 2018, last=Fri May 04 13:22:07 UTC 2018
> id=3adc9b5b-1ac7-01db-770c-11c622ec007c, login=admin, user=Administrator, since=Tue May 01 10:07:15 UTC 2018, last=Fri May 04 13:22:18 UTC 2018
> id=09d0a46b-0825-893c-e7a3-181d7b0a02d4, login=anonymous, user=Anonymous, since=Tue May 01 10:07:14 UTC 2018, last=Fri May 04 13:17:28 UTC 2018
> id=ff1c28ec-61b6-0b7b-99f7-ac736e9b16e1, login=admin, user=Administrator, since=Tue May 01 10:07:15 UTC 2018, last=Fri May 04 13:22:17 UTC 2018
> id=c29516e9-0420-dba1-c42d-f96a61591a20, login=restuser, user=Rest User, since=Fri May 04 13:17:27 UTC 2018, last=Fri May 04 13:19:55 UTC 2018
> id=7606e1ad-a5fa-5430-179a-082dc5b5c6a7, login=admin, user=Administrator, since=Fri Apr 20 18:55:17 UTC 2018, last=Fri Apr 20 18:55:17 UTC 2018
> id=95007db9-34a2-313a-842b-7b015b420881, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Mon Apr 30 07:02:10 UTC 2018
> id=f89783f0-acbe-42c8-4185-f839c2f15e96, login=admin, user=Administrator, since=Tue Apr 24 05:03:08 UTC 2018, last=Tue Apr 24 05:07:13 UTC 2018
> id=19af997e-0b2e-c94d-77f5-19e0631ab576, login=admin, user=Administrator, since=Wed Apr 25 06:24:22 UTC 2018, last=Wed Apr 25 15:30:21 UTC 2018
> id=1ecf9cee-c8c2-f481-8c04-9bb9803d622f, login=admin, user=Administrator, since=Thu Apr 26 06:39:07 UTC 2018, last=Sun Apr 29 14:51:39 UTC 2018
> id=5e07408c-bfe1-8bd5-0b88-9549fea44617, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 08:14:15 UTC 2018
> id=10a6a9bc-9846-b118-7bbe-21b0305a9edd, login=restuser, user=Rest User, since=Fri May 04 13:18:40 UTC 2018, last=Fri May 04 13:18:40 UTC 2018
> id=6542cf38-edcf-7e9d-980c-40e817c09cc3, login=admin, user=Administrator, since=Thu Apr 26 06:39:07 UTC 2018, last=Sun Apr 29 14:51:53 UTC 2018
> id=09de9136-0420-6c0a-40b9-5b5e19ec4d1b, login=admin, user=Administrator, since=Mon Apr 30 07:02:09 UTC 2018, last=Mon Apr 30 07:02:09 UTC 2018
> id=5b367118-06df-3e03-5725-39bdb75962e1, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Wed Apr 25 15:30:49 UTC 2018
> id=674cd104-63b2-04c9-1e1a-8c2ffe93e441, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Wed Apr 25 15:30:49 UTC 2018
> id=42518fdb-2a98-fae9-7222-b348f3b01cf5, login=restuser, user=Rest User, since=Fri May 04 12:54:04 UTC 2018, last=Fri May 04 12:54:04 UTC 2018
> id=57d06fd9-d4dd-3d93-de4c-987dd210c5b0, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Tue Apr 24 05:07:36 UTC 2018
> id=a51c6422-59ed-fc21-c967-b2af8a79e59a, login=restuser, user=Rest User, since=Fri May 04 12:58:02 UTC 2018, last=Fri May 04 12:58:02 UTC 2018
> id=6ca6e528-d94d-c1e0-c4f4-d388e4f9eb7b, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Sun Apr 29 14:52:25 UTC 2018
> id=f5050b17-ae8d-cdf2-7d5a-8bebfeee55ec, login=admin, user=Administrator, since=Tue May 01 05:07:05 UTC 2018, last=Tue May 01 05:07:05 UTC 2018
> id=3cd00447-9127-508f-0514-1ed35f79835f, login=admin, user=Administrator, since=Sun Apr 29 14:52:25 UTC 2018, last=Mon Apr 30 06:59:40 UTC 2018
> id=709d5809-9f64-5edf-fee2-5c0c12029c23, login=admin, user=Administrator, since=Fri Apr 20 18:53:57 UTC 2018, last=Fri Apr 20 18:54:59 UTC 2018
> id=13b06772-e2f9-e749-0be1-ab335ba3f8e6, login=admin, user=Administrator, since=Wed Apr 25 15:30:47 UTC 2018, last=Thu Apr 26 06:39:16 UTC 2018
> id=21d0379e-bff3-13e7-cea0-6e18f6c581c2, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Tue Apr 24 05:07:38 UTC 2018
> id=fba0d2f8-c2bf-323d-4b03-6d463aa9ecd1, login=admin, user=Administrator, since=Tue May 01 08:14:15 UTC 2018, last=Tue May 01 08:14:15 UTC 2018
> id=63507ebb-5f53-4581-2f40-8d3a2aecab46, login=admin, user=Administrator, since=Tue Apr 24 05:07:36 UTC 2018, last=Wed Apr 25 06:24:40 UTC 2018
> id=37149d59-8469-41e9-6c1d-943720415052, login=admin, user=Administrator, since=Tue May 01 08:10:40 UTC 2018, last=Tue May 01 08:13:13 UTC 2018
> id=68efe3b3-5d89-23cd-8424-dc57bc627afc, login=admin, user=Administrator, since=Mon Apr 30 06:59:17 UTC 2018, last=Mon Apr 30 06:59:17 UTC 2018
> id=abc8d062-d0e8-bb22-fa79-149211ae0dd2, login=admin, user=Administrator, since=Wed Apr 25 06:24:23 UTC 2018, last=Wed Apr 25 06:24:23 UTC 2018
> id=7f8e01e3-036e-f6d4-334a-213ab58466df, login=tom, user=Tom Dimonaco, since=Fri May 04 07:30:44 UTC 2018, last=Fri May 04 13:21:49 UTC 2018
> id=556a0464-168d-ba06-0bd8-6a2884ad8825, login=admin, user=Administrator, since=Tue May 01 08:10:39 UTC 2018, last=Tue May 01 08:13:42 UTC 2018

so they are still there I’m afraid. :confused:

Thanks again
Gabor

Hi,
Have your middleware servers correct (and the same) date and time?
Is the cuba.syncNewUserSessionReplication option enabled in your application?

I tried to reproduce the problem on a cluster but could not.

When the processEviction() method is invoked, the list of sessions is updated and old expired sessions are deleted. The expired sessions are also deleted from all the cluster nodes. It should work OK.

The only one idea why the issue takes place in your application is that your middleware node has been deployed incorrectly, and an old version of the library work there indeed.
Try to deploy the application on a brand new clean tomcat.
Or try to debug the processEviction() method in UserSessions.java.

  1. To launch tomcat in debug mode. To do it copy debug.bat(sh) and setenv.bat(sh) from “Fast deployment tomcat” to the bin directory of the node tomcat.
  2. Adjust remote debug connection to 8787 in IDE - define your host.
    image

Hi Rostislav,
They were one hour out, as they were set to UTC. Now I have changed all servers timezone to the correct one.

Is the cuba.syncNewUserSessionReplication option enabled in your application?

No, I haven’t known about that, what does that do?

I have debugged now the processeviction() function in UserSessions.java, on one of the live middlewares, and it turns out, that it actually steps in the foreach here:

public void processEviction() {
if (!AppContext.isStarted())
return;

    log.trace("Processing eviction");
    long now = timeSource.currentTimeMillis();

    getSessionInfoStream()
            .filter(info -> !info.session.isSystem() && now > (info.lastUsedTs + expirationTimeout * 1000))
            .forEach(usi -> {
                log.debug("Removing session due to timeout: {}", usi);

                userSessionLog.updateSessionLogRecord(usi.getSession(), SessionAction.EXPIRATION);

                removeSessionInfo(usi.session.getId());

                usi.lastUsedTs = 0;
                clusterManager.send(usi);
            });
}

Although I couldn’t find the message “Removing session due to timeout” message anywhere in the logs.
Most probably the issue is not right here, as if I try to remove the session with the disconnect button on the UI, it won’t get removed…
No error could be seen in any of the logs. How could this be?

Gabor

So I think now the question is narrowed down a bit, as the recent sessions are cleared out, now the question is why are there some stuck ones, and what prevents them cleared out even when I try them clear out directly.
Where are the sessions stored? I couldn’t see them in the database, and I have rebooted the middlewares quite a few times, they are still not cleared. We have two “active” middlewares in two AWS availability zones, and one extra to run bigger background tasks (that’s not used for logins, none of the frontends connect to it)

Cheers
Gabor

Hi Gabor,

Sessions are stored in middleware server memory, but replicated in the cluster, so as soon as a new server is up, it gets all active sessions from the neighbors. Have you ever rebooted all middleware servers at once?

As for the log messages, what logback.xml are you using in your deployments? Also, you can temporarily change logging level for a server in the Administration -> Server Log screen. In order to see messages from UserSessions you need to set DEBUG level for the com.haulmont.cuba.security.app.UserSessions logger. But make sure you do it for the right server - select appropriate JMX Connection.

Hi Konstantin,
Thanks, so that explains it, as the third server is configured in a separate container task file, therefore it’s rebooted with a 4-5 minutes difference to the core ones, so there is always at least one up, it explains now how the sessions are preserved.
Now I’ll need to find out why they are stuck, and why they cannot be removed. I can see the log that way, from the app, but cannot see any errors yet, will keep on trying, checking.
The logback.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<property name="logDir" value="/opt/cuba_home/logs"/>

<appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${logDir}/app.log</file>

    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>DEBUG</level>
    </filter>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- daily rollover -->
        <fileNamePattern>app.%d{yyyy-MM-dd}.log</fileNamePattern>
        <!-- keep 30 days' worth of history -->
        <maxHistory>30</maxHistory>
        <cleanHistoryOnStart>true</cleanHistoryOnStart>
    </rollingPolicy>

    <encoder>
        <pattern>%d{HH:mm:ss.SSS} %-5level [%thread%X{cubaApp}%X{cubaUser}] %logger - %msg%n</pattern>
    </encoder>
</appender>

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>INFO</level>
    </filter>

    <encoder>
        <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
    </encoder>
</appender>

<root>
    <appender-ref ref="Console"/>
    <appender-ref ref="File"/>
</root>

<!-- Begin CUBA -->

<logger name="com.haulmont.cuba" level="DEBUG"/>

<logger name="com.haulmont.cuba.core.sys" level="INFO"/>

<logger name="com.haulmont.cuba.core.sys.CubaDefaultListableBeanFactory" level="WARN"/>

<logger name="com.haulmont.cuba.core.app.scheduling" level="INFO"/>

<logger name="com.haulmont.cuba.web.sys" level="INFO"/>

<logger name="com.haulmont.cuba.portal" level="INFO"/>

<!-- End CUBA -->

<logger name="eclipselink" level="WARN"/>

<logger name="eclipselink.sql" level="INFO"/>

<logger name="org.springframework" level="WARN"/>

<logger name="org.activiti" level="INFO"/>

<logger name="freemarker" level="INFO"/>

<logger name="org.docx4j" level="INFO"/>

<logger name="org.hibernate" level="WARN"/>

<logger name="sun" level="INFO"/>

<logger name="com.sun" level="INFO"/>

<logger name="javax" level="INFO"/>

<logger name="org.apache" level="INFO"/>

<!-- Begin Perf4J  -->

<appender name="PerfStatFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${logDir}/perfstat.log</file>
    <append>true</append>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>app.%d{yyyy-MM-dd}.log</fileNamePattern>
        <maxHistory>30</maxHistory>
        <cleanHistoryOnStart>true</cleanHistoryOnStart>
    </rollingPolicy>

    <encoder>
        <pattern>%msg%n</pattern>
    </encoder>
</appender>

<appender name="CoalescingStatistics" class="org.perf4j.logback.AsyncCoalescingStatisticsAppender">
    <param name="TimeSlice" value="60000"/>
    <appender-ref ref="PerfStatFile"/>
</appender>

<appender name="UIPerfStatFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${logDir}/perfstat-ui.log</file>
    <append>true</append>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>app.%d{yyyy-MM-dd}.log</fileNamePattern>
        <maxHistory>30</maxHistory>
        <cleanHistoryOnStart>true</cleanHistoryOnStart>
    </rollingPolicy>

    <encoder>
        <pattern>%msg%n</pattern>
    </encoder>
</appender>

<appender name="UICoalescingStatistics" class="org.perf4j.logback.AsyncCoalescingStatisticsAppender">
    <param name="TimeSlice" value="120000"/>
    <appender-ref ref="UIPerfStatFile"/>
</appender>

<logger name="org.perf4j.TimingLogger" additivity="false" level="INFO">
    <appender-ref ref="CoalescingStatistics"/>
</logger>

<logger name="com.haulmont.cuba.gui.logging.UIPerformanceLogger" additivity="false" level="INFO">
    <appender-ref ref="UICoalescingStatistics"/>
</logger>

<!-- End Perf4J  -->

Cheers
Gabor