Rename script crash

I'd written a rename script for my CD rips from discogs.com and not used for more than a year.

Now DOpus 12.17 crashes every 20-25 CDs - see screen shot.

2019-09-29_07-12-15

Please send us the crash dumps and the rename script/preset/details. We should be able to fix it with those (if it's Opus crashing and not whatever the script is using to read from the web).

Leo,

it's mysterious - the crash always happens on other places anywhere in the code.

Just did e.g. this:

this.httpReq.send(null);
return this.httpReq.status;

var HttpStatus = ... result of function call above
if (HttpStatus != 200)

and this ends with ...
Type error # -2146823281: 'this.httpReq.status' is null or not an object

or another run:

Type error # -2146823281: 'position' is null or not an object

But the value for "position" was there before - ... so some properties are unexpected NULL from one statement to the next.

That's all very very mysterious.

When I restart DO or wait and rerun it works but maybe crashes on another code part - which had worked before - with all the same data.

I can reproduce it a few times (rerun) and then Opera crashes.

It will take some time to find out more info.

Is Opus actually crashing, or are parts of the script just failing and generating an error message in the script log?

Which language is the script written in? Looks like JScript? Maybe it needs some more checks for null objects? Or, if the objects are becoming null out of nowhere, that suggests there may be something wrong with the httpReq object being used. (Is that a Windows object, or something else?)

We can't really help much if we don't have the script or crash dumps (assuming the program is crashing, not just the script stopping with an error).

I know you want the source - but it wouldn't help at the moment (and would take some amount of time to prepare it), but see this:

Script crashes unmotivated with:

Type error # -2146823281: 'this.dgsr.community.status' is null or not an object

This is the only part where I use "community.status":

  this.hasValidStatus = function()
  {
    var Status = false; // Draft
    if (this.dgsr.community.status != null)
    {
    	// DOpus.Output("**STATUS: " + this.dgsr.community.status, false, true);
      if (this.dgsr.community.status.match(/^(?:Accepted)/))
      {
        Status = true;
      }
    }
    // Return
    return Status;
  }

Data part:

	"community": {
		"status": "Accepted",
		"rating": {
			"count": 73,
			"average": 4.4
		},

I add the DOpus.Output of the status field, rerun the script with same request (get same cached content from discogs), and it writes out the value, and the if worked - and finally all worked. Really strange - after "if != null" and it's not an object.

I will investigate much more asap.

I don't know what this or dgsr are in this context. Are they objects provided by Opus, or a Windows component, or a third-party scripting component?

Is this a question about Opus, or about the component you're using to load and parse JSON data from the web? Does similar code work if you run it from outside of Opus?

this is only from the current class and dgsr the object of the http request however.

Just got this:

I write out the content of httpReq.responseText and then I do same but only stringified and it tells me the value is null or not an object?

    DOpus.Output("----", false, true);
    DOpus.Output(this.httpReq.responseText);
    DOpus.Output("=============", false, true);
    DOpus.Output("discogs Return (JSON)", false, true);
    DOpus.Output("=====================", false, true);
    DOpus.Output(JSON.stringify(JSON.parse(this.httpReq.responseText), null, 2));
    DOpus.Output("=============", false, true);
<snipped>
"https://api.discogs.com/labels/68868", "id": 68868, "entity_type_name": "Published By"}, {"name": "A Flock Of Seagulls Publishing", "entity_type": "21", "catno": "", "resource_url": "https://api.discogs.com/labels/299002", "id": 299002, "entity_type_name": "Published By"}, {"name": "Disctronics USA", "entity_type": "31", "catno": "", "resource_url": "https://api.discogs.com/labels/50892", "id": 50892, "entity_type_name": "Glass Mastered At"}], "uri": "https://www.discogs.com/A-Flock-Of-Seagulls-Greatest-Hits-Remixed/release/527326", "formats": [{"descriptions": ["Compilation"], "name": "CD", "qty": "1"}], "resource_url": "https://api.discogs.com/releases/527326", "data_quality": "Needs Vote"}
 2019-10-06 17:15  =============
 2019-10-06 17:15  discogs Return (JSON)
 2019-10-06 17:15  =====================
 2019-10-06 17:15  Type error # -2146823281: 'this.httpReq.responseText' is null or not an object

How can the string be printed and then there is "nothing" in the code and the parse + stringify function crash with this.httpReq.responseText is null or not an object ?

Mysterious. No change of the value! Values will be changed "under the hood"?

Is the httpReq asynchronous?

If so, it may not have completed yet, which could explain why it is changing between lines:

While handling an asynchronous request, the value of responseText always has the current content received from the server, even if it's incomplete because the data has not been completely received yet.

You know the entire content has been received when the value of readyState becomes XMLHttpRequest.DONE ( 4 ), and status becomes 200 ( "OK" ).

But this seems like a question about how to use the httpReq object or JScript in general, and not about Opus, so I can only really guess.

Another change in the code output =>

DOpus.Output(this.httpReq.responseText);
DOpus.Output("-**-", false, true);
DOpus.Output(typeof(this.httpReq.responseText), false, true);
DOpus.Output("****", false, true);

now returns this =>

<snipped>
Remixed/release/527326", "formats": [{"descriptions": ["Compilation"], "name": "CD", "qty": "1"}], "resource_url": "https://api.discogs.com/releases/527326", "data_quality": "Needs Vote"}
 2019-10-06 17:45  -**-
 2019-10-06 17:45  Type error # -2146823281: 'this.httpReq' is null or not an object

See the interesting error - only this.httpReq and not this.httpReq.responseText anymore. How can this be?

this.httpReq is this: this.httpReq = new ActiveXObject("MSXML2.XMLHTTP.6.0");

?

Complete code part short.

It's synchron (false in open). Directly after I've reveived the return I write the complete part into a file incl. the headers. ReadyState is 4 and HTTP status code is 200 - which I also check after the debug output above.

this.httpReq = new ActiveXObject("MSXML2.XMLHTTP.6.0");
this.httpReq.open("GET", FullUri, false);
this.httpReq.setRequestHeader("Accept", "application/vnd.discogs.v2.discogs+json");
this.httpReq.setRequestHeader("User-Agent", this.Config.UserAgent);
this.httpReq.send(null);

Running Windows 10 64bit, 1903, build 18362.388.
Last year when it has worked I was running 1803. :wink:

Anywhere Anytime - also between the DOpus.Output lines: 2019-10-06 19:05 typeof this.httpReq: unknown

I don't know. This isn't about Opus anymore.

Just to bring this back to Opus, if you send us the crash dumps we should at least be able to work out where/why it's crashing.

Recent Windows updates may have made IE-related JScript components unstable, which might explain why your script was working until recently.

From Microsoft releases even more patches for the CVE-2019-1367 IE zero-day, and the bugs are having a field day | Computerworld

It's also possible they're unrelated. If you can send the crash dumps to us, we might be able say what's most likely.