@Kem Tekinay, the one user I had with the issue – and evidently with a fast enough machine to expose the problem – won’t be running any of my software now until next year. But I’ll send him an email and see if he will run tests for me. If so, I’ll make him a build with what is in that branch and ask him to try it.
[quote=488870:@Kem Tekinay]I just looked and the example test app is storing the UpdateChecker in a property. This is recommended, even required, for any object that acts asynchronously, but I imagine others will use local variables too and rely on the event handler to return the instance. As such, I’ll change the code in an attempt to compensate by forcing the instance to be kept alive until the data is fetched.
Edit:
This is why I should look before posting. The code already holds an instance during the async operation, so whatever the issue, that’s not it.[/quote]
Although the Test app stores the instance of UpdateChecker in a property (Checker
is a property):
Dim u As New Kaju.UpdateChecker( App.PrefFolder )
...
Checker = u
It looks like the Admin app doesn’t:
Dim u As New Kaju.UpdateChecker( f )
#pragma unused u
Also, the README shows this snippet of code in the Step by Step section:
dim updater as new Kaju.UpdateChecker( myAppPrefFolder )
...
updater.ExecuteAsync
Which also implies that it’s stored in a local variable - perhaps it should be made clear that it should be put in a property here too.
Careful with that bragging
To be clear, the class itself holds its own instance during async operations in a shared array. As such, no matter where you put it, it cannot go out of scope until the async operation is complete or errors. That’s the thing I thought of during my original coding, so no modification to the example or Admin code, or docs, is needed.
[ OK ] Bragging Rights daemon Started
Ahha. Bragging rights are established once again. Nice work.
BTW I’ve tested your new branch on a development build and all seems to be working ok on the Mac. Did a quick test on Ubuntu too, but still getting the seg. fault there (as reported above and in Feedback Case (https://xojo.com/issue/59800)]#59800).
You mean the To_URLConnection branch, right?
Yes.
@Kem, sorry for the delay but I wanted to wait to respond until that user had tried it.
Sadly, using the To_URLConnection branch it still works fine for every machine I have tried EXCEPT his. He reports he does not get prompted to update, and the menu option to check for updates does not report “No updates available” like it does for other machines. So it acts the same as the prior Kaju build did for this user.
Would you like me to try putting the updatechecker into an App class property? The Kaju classes would remain the same – just how my App.Open() and menu handler call it would change.
Yes, please. This is a real head scratcher.
@Kem Tekinay, my user just got back to me and using an App class property (which I called mUpdateChecker) did NOT do it. Here is my revised code at the end of App.Open():
if mKajuPrefsAppPath <> nil and mKajuPrefsAppPath.Exists then
mUpdateChecker = new Kaju.UpdateChecker( mKajuPrefsAppPath )
mUpdateChecker.AllowRedirection = true
mUpdateChecker.ServerPublicRSAKey = kKajuPublicKey
mUpdateChecker.UpdateURL = kKajuUpdateURL
// Only check for final versions not previously ignored
mUpdateChecker.AllowedStage = App.Final
mUpdateChecker.HonorIgnored = true
// Only allow window if update is available
mUpdateChecker.AllowedInteraction = Kaju.UpdateChecker.kAllowUpdateWindow
AddHandler mUpdateChecker.ExecuteAsyncComplete, WeakAddressOf Checker_ExecuteAsyncComplete
mUpdateChecker.ExecuteAsync
end if
So I don’t think it can be going out of scope now. The mUpdateChecker is a public property that I added to the App class.
What else would you like me to try?
What if they trash the prefs at mKajuPrefsAppPath?
Is this just on the theory he may have an ignore set? I also have a menu option, and when he takes it he does NOT get any dialog at all including the “No updates available” that I get and everyone else gets. The menu handler looks like this:
// See App.Open for some required setup
// If we have app prefs folder, initialize update check
if mKajuPrefsAppPath <> nil and mKajuPrefsAppPath.Exists then
mUpdateChecker = new Kaju.UpdateChecker( mKajuPrefsAppPath )
mUpdateChecker.AllowRedirection = true
mUpdateChecker.ServerPublicRSAKey = kKajuPublicKey
mUpdateChecker.UpdateURL = kKajuUpdateURL
// Unlike app startup checks, show ignored final versions also
mUpdateChecker.AllowedStage = App.Final
mUpdateChecker.HonorIgnored = false
// Allow window all the time (even if error etc)
mUpdateChecker.AllowedInteraction = Kaju.UpdateChecker.kAllowAll
AddHandler mUpdateChecker.ExecuteAsyncComplete, WeakAddressOf Checker_ExecuteAsyncComplete
mUpdateChecker.ExecuteAsync
else
MsgBox "Unable to check for updates" + EndOfLine + EndOfLine + _
"No preference file path is available. Please contact support."
end if
Return True
Note the .HonorIgnored = false statement.
If you like, I can still have him delete the prefs file and try again but figured I could get you the above information faster if that was the only reason to ask.
Yeah, that was it, but I’d still like to see.
Where does “Checker_ExcecuteAsyncComplete” live?
It lives as a private scoped method in the App class. (I think I just lifted it from one of your sample projects?)
Probably.
I just released v.2.1.
https://github.com/ktekinay/Kaju
The biggest change is that you can call ExecuteAsync instead of the synchronous Execute. These are the full release notes:
-
KajuUpdateWindow: Changed
hsSocket
to aURLConnection
object. -
UpdateChecker: Added
ExecuteAsync
that will check for updates asynchronously usingURLConnection
andLastError
for HTTP errors that occur when using that method. -
UpdateChecker: Deprecated
Execute
. -
UpdateChecker: Use
URLConnection
unlessExecute
is used whereAllowRedirection
isFalse
. - UpdateChecker: Added results for “PageNotFound”, “PageRedirected”, and “FetchingUpdateInfo”.
- UpdateChecker: Better handling of a URL in the form “http://un:pw@path”.
-
UpdateChecker: Changed
Result
to a read-only computed property and made themResult
shadow property hidden. - UpdateChecker: Removed events that were not being raised anyway.
- UpdateChecker: Make sure each version has a security token (see below).
- UpdateChecker: Validate the downloaded packet against every form of EOL with and without Trim in case that got changed along the way.
-
UpdateChecker:
OSIsSupported
will try twice to find the tools it needs and log any errors. - UpdateInformation: Will fetch images and release notes asynchronously.
- UpdateInitiater: Fixed Windows script issue that could have prevented re-launch of the application.
- Test App: The window will let you specify Asynchronous and your own URL and/or public key. It will also allow testing of simple HTTP authenticated directories.
- Test App: Asynchronous is now the default.
- Admin App: Fixed issues with saving and alias tracking. (Alias tracking does not work on Windows.)
- Admin App: Better UI handling on Windows.
- General: Code changes for easier debugging.
- General: All HTTP requests now include headers to disable caching.
- General: Exported information file contains a security token to make sure that each export has a different RSA signature.
- General: Handle IOException.
- General: Updated build script to look for kaju cli in “Builds” folder as named in the newer Xojo versions.
Thanks!
It seems that Kaju is down again, No idea why, I keep on getting the error “Error, user choose to try later” , no matter what I do and how I doit I keep on getting same thing.
So far debugging the kaju side it seems that first time you check the url you get the link on Kaju.UpdateChecker.ProcessRaw you get all the update file then it goes to Kaju.UpdateChecker.FetchAndProcess the raw is blank, while previously was full with all the data, then it goes to Kaju.UpdateChecker.ProcessRaw goes empty and finally it throws that error, same on Sync and Async. Any ideas are welcomed.
Thanks.
As an update, I managed to reach to the point where the app gets downloaded, it decompresses the zip, and keeps it in the temp decompressed folder and the app is frozen on “Processing file…” no other details , no hang , no crash, no debug log, just stays there .
I am seeing exactly the same thing. The pre-July 2020 version still seems to work fine with the current compiler. Not the easiest thing to debug (basically there must be some forked process that waits for the decompressed file and isn’t recognizing that it is there, but I can’t see it). For now using the slightly older (though still labeled 2.1!) version.