Skip to content

Close connection if Exception is raised #3

@ahartikainen

Description

@ahartikainen

Currently, the shutdown procedure is not called if model_string is invalid. This keeps the port (8080) locked.

import pystan
model_string = "parameters {vector y;} model {y ~ cauchy(0,1);}"
program = pystan.compile(model_string, {})
# AssertionError is raised

model_string2 = "parameters {vector[10] y;} model {y ~ cauchy(0,1);}"
program2 = pystan.compile(model_string2, {})
# OSError is raised 
# OSError: [Errno 48] error while attempting to bind on address ('127.0.0.1', 8080): address already in use

One solution is to add try-finally blocks for post and post_aiter functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions