AI-Planning / planning-as-a-service

The newly improved planner (and more) in the cloud.
Apache License 2.0
31 stars 8 forks source link

Connection error #54

Closed YukeshShr closed 8 months ago

YukeshShr commented 8 months ago

When I keep trying to send a request using solve_request_url=requests.post("http://localhost:5001/package/optic/solve", json=req_body).json()

It keeps returning the error: requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

and I am not sure why, as when I access the url that is being posted to, I can see it is up and running. Has anyone else come across this?

haz commented 8 months ago

Are you running the server locally? Looks like your planner endpoint is localhost.

YukeshShr commented 8 months ago

Yeah, I was running it locally. The issue was because of redis and mysql, I had not pulled the corresponding docker images, so the connection was never able to be established correctly.

YukeshShr commented 8 months ago

I've set it up correctly and now works, but when I try to generate a second plan, after the first one has generated, it keeps returning the error: ['', 'Errors: 1, warnings: 22', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 13: Warning: Undeclared requirement :typing ', 'problem: line: 16: Warning: Undeclared symbol: at', 'problem: line: 17: Warning: Undeclared symbol: free', 'problem: line: 19: Warning: Undeclared symbol: closer', 'problem: line: 24: Warning: Undeclared symbol: connected', 'problem: line: 30: Warning: Undeclared symbol: drive-time', 'problem: line: 30: Warning: Undeclared requirement :number-fluents ', 'problem: line: 31: Warning: Undeclared requirement :number-fluents ', 'problem: line: 32: Warning: Undeclared requirement :number-fluents ', 'problem: line: 33: Warning: Undeclared requirement :number-fluents ', 'problem: line: 34: Warning: Undeclared requirement :number-fluents ', 'problem: line: 35: Warning: Undeclared requirement :number-fluents ', 'problem: line: 38: Warning: Undeclared symbol: delivered', 'problem: line: 45: Error: Syntax error in problem file - types used, but no ' ':types section in domain file.', '']

I can confirm that the domain and problem file are correct, as I tested this issue by generating a plan using the same domain and problem file.

haz commented 8 months ago

Can you try to generate two plans in a row with the exact same settings? (pddl, planner, etc)

YukeshShr commented 8 months ago

Yeah, I have tried that out, used the optic planner, same pddl files, but the second time it would generate, it always returns the error

haz commented 8 months ago

Very weird...want to post the full code?

YukeshShr commented 8 months ago

Sure thing.

def generate_plan(domain_file, problem_file):
    domain = request.files[domain_file].read().decode('utf-8')
    problem = request.files[problem_file].read().decode('utf-8')
    req_body = {
        "domain": domain,
        "problem": problem
    }

    # Send job request to solve endpoint
    solve_request_url=requests.post("http://localhost:5001/package/optic/solve", json=req_body).json()
    print(solve_request_url['result'])

    celery_result=requests.post('http://localhost:5001' + solve_request_url['result'])

    print('Computing...')
    while celery_result.json().get("status","")== 'PENDING':

        # Query the result every 0.5 seconds while the job is executing
        celery_result=requests.post('http://localhost:5001' + solve_request_url['result'])
        time.sleep(0.5)

    result = celery_result.json()['result']['output']['plan']
    print('Computed!')
    return result.split('\n')

This is the code that I use to generate the plan.

haz commented 8 months ago

And you call this twice in a row?

YukeshShr commented 8 months ago

Yeah, I call the method that carries out that functionality:

  original = generate_plan('original', 'problem')
  constrained = generate_plan('original', 'constrained')
haz commented 8 months ago

Can you try and see if it fails on the remote solver too? Swap the local host with https://solver.planning.domains:5001/

YukeshShr commented 8 months ago

Same error is returned when using the remote solver as well. This is what gets returned on the second solver post request:

['',
 'Errors: 1, warnings: 21',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 12: Warning: Undeclared requirement :typing ',
 'problem: line: 15: Warning: Undeclared symbol: at',
 'problem: line: 16: Warning: Undeclared symbol: free',
 'problem: line: 18: Warning: Undeclared symbol: closer',
 'problem: line: 22: Warning: Undeclared symbol: connected',
 'problem: line: 28: Warning: Undeclared symbol: drive-time',
 'problem: line: 28: Warning: Undeclared requirement :number-fluents ',
 'problem: line: 29: Warning: Undeclared requirement :number-fluents ',
 'problem: line: 30: Warning: Undeclared requirement :number-fluents ',
 'problem: line: 31: Warning: Undeclared requirement :number-fluents ',
 'problem: line: 32: Warning: Undeclared requirement :number-fluents ',
 'problem: line: 33: Warning: Undeclared requirement :number-fluents ',
 'problem: line: 36: Warning: Undeclared symbol: delivered',
 'problem: line: 42: Error: Syntax error in problem file - types used, but no '
 ':types section in domain file.',
 '']
haz commented 8 months ago

If you instead run this, does it succeed?

  # original = generate_plan('original', 'problem')
  constrained = generate_plan('original', 'constrained')

I.e., don't bother requesting the first.

YukeshShr commented 8 months ago

Hi there,

I ended up getting it to work with the local host but from this morning, I have been getting the error: requests.exceptions.SSLError: HTTPSConnectionPool(host='solver.planning.domains', port=5001): Max retries exceeded with url: /package/optic/solve (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1006)')))

Is the local host no longer usable?

haz commented 8 months ago

That means you weren't using the localhost, but the remote one. There was a certificate issue with SSL, but it's now resolved.

YukeshShr commented 8 months ago

Oh yeh sorry for the confusion.

I'm using the localhost for now, and when trying to generate a plan for using a specific domain and problem file combo, I always get the error: 'Error': 'This Planutils package is not configured correctly'

Do you know why this is being returned?

haz commented 8 months ago

Most often it's because the parameters sent are wrong, or that planner isn't equipped to handle remote calls. Which planner?

YukeshShr commented 8 months ago

Ah okay, I am using OPTIC.

I tested it with the remote host and it worked fine. Would you be able to let me know how long the certificate for the remote host is valid for?

haz commented 8 months ago

The SSL certificate needs renewal every 6 months, but that's on us running the server to figure out. It's meant to be automatic, but we have some server configuration maintenance that's required to make that a reality.

Going to mark this issue as closed, as I don't think there is a bug corresponding to it with the PaaS software. Happy to continue the conversation over in slack.planning.domains if you'd like.