myfaces icon indicating copy to clipboard operation
myfaces copied to clipboard

MYFACES-4660 4.1 view destroying fix + keeping track of user connection in multiple tabs

Open milansie opened this issue 1 year ago • 4 comments

1/ when the view is destroyed (i.e. the user reaches the NUMBER_OF_VIEWS_IN_SESSION limit), sessionScope channels are not destroyed. Channel could still be active for other views or newly created ones. In other words, session-scoped channels only get destroyed when the entire session is destroyed.

2/ we have to track number of user channelToken usage connections (when the user is using same channelToken in multiple browser windows / tabs with same http session, the channelToken remains same), and we can't close this channel until all user connections to this channel are closed (all tabs/windows).

milansie avatar Apr 21 '24 10:04 milansie

how are the channelTokens generated? i wonder that if you open index.xhtml in two different tabs, does it use the same channelToken? this creates 2 slots in the "NUMBER_OF_VIEWS_IN_SESSION". If one is closed, only the viewscope bean of this one should and the channel of this should be closed. Not both.

tandraschko avatar Apr 24 '24 12:04 tandraschko

Yup, it seems so. If the channel is applicationScope, only one channelToken exists for the application. If the channel scope is session (and user is specified), there is same channelToken with two websocket sessions connected.

you are right, only one ViewScope bean is closed. But session channelToken was also removed (not destroying the session, only removing the channelToken from sessionScope bean), and therefore registering new websocket session for this user session fails by websocket eror code 1011

how are the channelTokens generated? i wonder that if you open index.xhtml in two different tabs, does it use the same channelToken? this creates 2 slots in the "NUMBER_OF_VIEWS_IN_SESSION". If one is closed, only the viewscope bean of this one should and the channel of this should be closed. Not both.

milansie avatar Apr 24 '24 13:04 milansie

TBH i would some time for debugging and i dont have this

maybe just the channelToken generation is wrong, dont know currently, sorry

tandraschko avatar Apr 24 '24 13:04 tandraschko

@milansie do you have discord? we could chat about this in the PF discord i would get rid of open PRs ;D

tandraschko avatar Oct 15 '24 13:10 tandraschko