Skip to content

pause and resume of proxy with inactivity timeout causes proxy to be immediately deleted after successful resume #101

@damianslee

Description

@damianslee

example case in testing backend support for pause and resume on snowpark container services service suspend resume.

if i have a inactivity timeout set in shiny proxy for say 5 minutes.
i pause my app/proxy. service in spcs suspends
go back to app screen or admin screen.
watch inactivity timeout exceed 5 minutes.
app remains in paused state not deleted as expected.
open the app again, it resumes as expected.
immediately app is deleted due to inactivity.

heartbeat-rate: 10000
heartbeat-timeout: 300000

suggested fix.

ProxyService.java

import eu.openanalytics.containerproxy.service.heartbeat.HeartbeatService;


    @Inject
    @Lazy
    private HeartbeatService heartbeatService;
    

    public Command resumeProxy(Authentication user, Proxy proxy, Map<String, String> parameters) {
...
            Proxy result = startOrResumeProxy(user, parameterizedProxy, null);

            if (result != null) {
                slog.info(result, "Proxy resumed");
                applicationEventPublisher.publishEvent(new ProxyResumeEvent(result));
                // Reset heartbeat so inactivity timer does not immediately stop the proxy after resume
                heartbeatService.heartbeatReceived(HeartbeatService.HeartbeatSource.INTERNAL, result, null);

                // final check to see if the app was stopped
                cleanupIfPendingAppWasStopped(result);
            }
...
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions