URLConnection failing in Xojo WebApp running on Raspberry Pi

I’ve got an odd issue with “URLConnection”. I wrote a small test WebApplication that uses URLConnection to perform a HTTP GET.

This test application fails when run on a Raspberry Pi but works when run on Ubuntu. “libsoup2.4” is installed on both Raspbian and Ubuntu.

When the application fails on Raspbian, it simply drops out of the debugger without throwing an exception. So I have no way to see what the problem might be.

On Raspbian, when I issue the “SendSync” command, the “AuthenticationRequested” event isn’t fired and the application dies without any indication why.

On Ubuntu everything completes and I receive the results of the HTTP GET.

Has anyone else seen this?

PS. I finally gave up and reverted to the old-school “HTTPSocket.Get” which works fine on both Raspbian and Ubuntu.

I would like to use URLConnection because I’m making an effort to adopt the new Xojo API but it doesn’t look like I can in this case.

It might have something to do with raspberry pi using 32bit libraries. Maybe see if you can capture the error in App.UnhandledException, I find sometimes the debugger can’t properly handle some exceptions but if you build the app it shows up in UnhandledException. Double-check that it’s failing exactly on SendSync and not when you are trying to read headers or such.

Run the app from a terminal and cause the URLConnection call to run. It should show you why it’s crashing.

@Greg_O𖽑Lone, I have filed a Feedback case:

61150 - raspberry pi debugger urlconnect

The problem can be reproduced consistently if certain conditions are met:

  1. Project is executed with “Project | Run Remotely | <name of your debugger host>”
  2. The debugger host is a Raspberry Pi.
  3. The URLConnection host must require authorization.
  4. A breakpoint is set withing the “AuthorizationHandler” method.

If you remove the breakpoint from the AuthorizationHandler method the project will execute without perfectly without crashing/quitting.

The RemoteConsoleDebugger does not issue any stderr or stdout messages to its terminal window that would indicate a problem. The program simply crashes/quits.

If this project is executed on a Ubuntu system, a breakpoint can be set in the AuthorizationHandler method and the breakpoint works without crashing/quitting.

When you run it from a terminal, what gets printed there when it crashes?

It doesn’t crash when run from a terminal (without the debugger.) It only crashes when the RemoteConsoleDebugger is being used.

I have run the RemoteConsoleDebugger in a terminal window and it only emits the usual messages about my program being uploaded etc. Then when the program crashes, the debugger just says that my program has ended.

How about this… have you implemented App.UnhandledException? If so, could you have it write the stack to a file?

My guess is that there is something that’s different because of the debugger stub… like a file isn’t where you expect it to be, or the working directory is different, or something like that.

1 Like

@Greg_O_Lone I installed an “UnhandledException” event handler but no joy.

I decided to record a video of the issue:

Screen capture video

So, what ever is causing this is pretty well hidden and doesn’t want to be found.

-Wes

1 Like

Since you’re a Pro user, have you tried this with the prerelease?

@Greg_O_Lone: Where do I find the ‘prerelease’?

If you look in the #testers channel there should be a pinned message at the top with links to the download.

I’ve just tested a URLConnection on a NanoPi and RaspberryPi both work.
Must have “libsoup2.4-1” and “libunwind8”.

Test SendSync and Send (async) both worked in the prerelase.
Can you verify @Wes_Westhaver ?
i’ve tested on https://httpbin.org/get?test=1234
Not sure if the problem could be “https” or “http”
if “http” tou may want to set

URLConnection.AllowCertificateValidation = false