Open Bug 1899784 Opened 2 years ago Updated 14 days ago

C-C TB, many warnings NS_ENSURE_SUCCESS(mStatus, mStatus) failed with result 0x804B000A (NS_ERROR_MALFORMED_URI): file .../dist/include/nsIURIMutator.h:610 during local mochitest with FULL DEBUG version of C-C TB

Categories

(Thunderbird :: General, defect)

Thunderbird 128
x86_64
Linux
defect

Tracking

(Not tracked)

People

(Reporter: ishikawa, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dupeme, regression)

During my local run of xpcshell test with FULLDEBUG version of C-C TB, I noticed that the following warning
is recroded more than 3K times. That is a bit excessive. This is in the top 5 of warnings list.
This warning is a new comer. It did not show up in the log about 18 days ago.

3900: Main Thread] WARNING: NS_ENSURE_SUCCESS(mStatus, mStatus) failed with result 0x804B000A (NS_ERROR_MALFORMED_URI): file /NEW-SSD/moz-obj-dir/objdir-tb3/dist/include/nsIURIMutator.h:610

3900 is the number of times it occurred.

The code comes from GENERATED nsIURIMutaror.h:

  template <class C>
  [[nodiscard]] nsresult Finalize(nsCOMPtr<C>& aURI)
  {
    NS_ENSURE_SUCCESS(mStatus, mStatus);  <==== HERE
    nsCOMPtr<nsIURI> uri;
    mStatus = mMutator->Finalize(getter_AddRefs(uri));
    NS_ENSURE_SUCCESS(mStatus, mStatus);
    aURI = do_QueryInterface(uri, &mStatus);
    NS_ENSURE_SUCCESS(mStatus, mStatus);
    mStatus = NS_ERROR_NOT_AVAILABLE; // Second call to Finalize should fail.
    return NS_OK;
  }

I also noticed that in my local log, the warning is always preceded by a failure message that is inserted by me.
That comes from SetSpec failure.
I counted the SetSepc failure:

    594 {debug} SetSpec failed. : aSpec=imap://Local Folder
   3095 {debug} SetSpec failed. : aSpec=imap://Local Folders
      1 {debug} SetSpec failed. : aSpec=imap://Local Folders-1
    201 {debug} SetSpec failed. : aSpec=imap://smart mailboxes
      5 {debug} SetSpec failed. : aSpec=imap://Smart Mailboxes
      4 Entering nsPop3Sink::EndMailDelivery(){debug} SetSpec failed. : aSpec=imap://Local Folders

The last line is due to a missing new line in one of the debug dump statement, I think.
The number adds up to 3900. So every warning is preceded by SetSpec failure message.
This may give a hint to whoever can debug this issue.

I added SetSpec failure dump many years ago. It seems that C-C TB used somewhat strange idea of URI, some of which are not recognized as valid by the rest of mozilla code.

The following is a list of SetSpec failure debug messages in my latest xpcshell test log.

      3 {debug} SetSpec failed. : aSpec=document.getElementById(
    594 {debug} SetSpec failed. : aSpec=imap://Local Folder
   3095 {debug} SetSpec failed. : aSpec=imap://Local Folders
      1 {debug} SetSpec failed. : aSpec=imap://Local Folders-1
    201 {debug} SetSpec failed. : aSpec=imap://smart mailboxes
      5 {debug} SetSpec failed. : aSpec=imap://Smart Mailboxes
      4 Entering nsPop3Sink::EndMailDelivery(){debug} SetSpec failed. : aSpec=imap://Local Folders

And this is the list from the latest local mochitest log. C-C TB is wasting many CPU cycles trying to use an invalid URIs, I think

    540 {debug} SetSpec failed. : aSpec=branding/brand.ftl
    976 {debug} SetSpec failed. : aSpec=calendar/calendar-invitation-panel.ftl
      8 {debug} SetSpec failed. : aSpec=calendar/calendar-widgets.ftl
    326 {debug} SetSpec failed. : aSpec=calendar/category-dialog.ftl
    326 {debug} SetSpec failed. : aSpec=calendar/preferences.ftl
     11 {debug} SetSpec failed. : aSpec=DTD/xhtml1-strict.dtd
    180 {debug} SetSpec failed. : aSpec=messenger/about3Pane.ftl
     76 {debug} SetSpec failed. : aSpec=messenger/aboutAddonsExtra.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/aboutDialog.ftl
      9 {debug} SetSpec failed. : aSpec=messenger/aboutImport.ftl
     33 {debug} SetSpec failed. : aSpec=messenger/aboutSupportCalendar.ftl
     33 {debug} SetSpec failed. : aSpec=messenger/aboutSupportChat.ftl
     33 {debug} SetSpec failed. : aSpec=messenger/aboutSupportMail.ftl
     11 {debug} SetSpec failed. : aSpec=messenger/accountcreation/accountSetup.ftl
      6 {debug} SetSpec failed. : aSpec=messenger/accountManager.ftl
     23 {debug} SetSpec failed. : aSpec=messenger/accountProvisioner.ftl
    398 {debug} SetSpec failed. : aSpec=messenger/addressbook/aboutAddressBook.ftl
    398 {debug} SetSpec failed. : aSpec=messenger/addressbook/vcard.ftl
    392 {debug} SetSpec failed. : aSpec=messenger/appmenu.ftl
     76 {debug} SetSpec failed. : aSpec=messenger/extensionPermissions.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/messageheader/headerFields.ftl
   1156 {debug} SetSpec failed. : aSpec=messenger/messenger.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/openpgp/msgReadStatus.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/openpgp/openpgp-frontend.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/openpgp/openpgp.ftl
     68 {debug} SetSpec failed. : aSpec=messenger/otr/chat.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/attachment-reminder.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/colors.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/connection.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/cookies.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/dock-options.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/fonts.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/languages.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/new-tag.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/notifications.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/offline.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/passwordManager.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/permissions.ftl
    718 {debug} SetSpec failed. : aSpec=messenger/preferences/preferences.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/receipts.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/sync-dialog.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/system-integration.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/syncAccounts.ftl
    572 {debug} SetSpec failed. : aSpec=messenger/treeView.ftl
      2 {debug} SetSpec failed. : aSpec=moz-icon://
      2 {debug} SetSpec failed. : aSpec=moz-icon://chrome://calendar/content/sound.wav?size=16
     17 {debug} SetSpec failed. : aSpec=moz-icon://https://www.mozilla.org/?size=16&contentType=
      2 {debug} SetSpec failed. : aSpec=notarealaddress
      1 {debug} SetSpec failed. : aSpec=null
    326 {debug} SetSpec failed. : aSpec=security/certificates/certManager.ftl
    326 {debug} SetSpec failed. : aSpec=security/certificates/deviceManager.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/about/aboutAddons.ftl
     18 {debug} SetSpec failed. : aSpec=toolkit/about/aboutMozilla.ftl
      3 {debug} SetSpec failed. : aSpec=toolkit/about/aboutProfiles.ftl
     33 {debug} SetSpec failed. : aSpec=toolkit/about/aboutSupport.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/about/abuseReports.ftl
    329 {debug} SetSpec failed. : aSpec=toolkit/about/config.ftl
   1869 {debug} SetSpec failed. : aSpec=toolkit/global/arrowscrollbox.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/global/mozFiveStar.ftl
    120 {debug} SetSpec failed. : aSpec=toolkit/global/mozMessageBar.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/global/mozSupportLink.ftl
     51 {debug} SetSpec failed. : aSpec=toolkit/global/notification.ftl
     33 {debug} SetSpec failed. : aSpec=toolkit/global/processTypes.ftl
     33 {debug} SetSpec failed. : aSpec=toolkit/global/resetProfile.ftl
   1561 {debug} SetSpec failed. : aSpec=toolkit/global/textActions.ftl
   1156 {debug} SetSpec failed. : aSpec=toolkit/main-window/findbar.ftl
     48 {debug} SetSpec failed. : aSpec=toolkit/neterror/certError.ftl
     48 {debug} SetSpec failed. : aSpec=toolkit/neterror/netError.ftl
    326 {debug} SetSpec failed. : aSpec=toolkit/updates/history.ftl
     12 {debug} SetSpec failed. : aSpec=undefined

Regarding SetSpec, we should be aware of bug 1876483.

But this failure in Finalize ought to be handled separately anyway, which means
we need to figure out the calling sequence that seem to use the following URIs and
correct the URI to something sensible.
Given that all the failed spec is prefixed with "Imap:", I think it is IMAP handling code.

    594 {debug} SetSpec failed. : aSpec=imap://Local Folder
   3095 {debug} SetSpec failed. : aSpec=imap://Local Folders
      1 {debug} SetSpec failed. : aSpec=imap://Local Folders-1
    201 {debug} SetSpec failed. : aSpec=imap://smart mailboxes
      5 {debug} SetSpec failed. : aSpec=imap://Smart Mailboxes
      4 Entering nsPop3Sink::EndMailDelivery(){debug} SetSpec failed. : aSpec=imap://Local Folders

BTW, this is how I dumped SetSpec failures.

# HG changeset patch
# User ISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
# Parent  7d43824932ee857cbf630e151b4993cc118d03cf
dump aSpec(i.e., path) for SetSpec failure

diff --git a/netwerk/base/nsIURIMutator.idl b/netwerk/base/nsIURIMutator.idl
--- a/netwerk/base/nsIURIMutator.idl
+++ b/netwerk/base/nsIURIMutator.idl
@@ -334,16 +334,29 @@ public:
   }
 
   NS_MutateURI& SetSpec(const nsACString& aSpec)
   {
     if (NS_FAILED(mStatus)) {
       return *this;
     }
     mStatus = mMutator->SetSpec(aSpec, nullptr);
+#if DEBUG
+    if (NS_FAILED(mStatus)) {
+      char *l_data;
+      char l_string[256];
+      int len = aSpec.Length();
+      int upper = len > 255 ? 255: len;
+      l_data =  ToNewCString(aSpec);
+      bcopy(l_data, l_string, upper);
+      l_string[upper] = '\0';
+
+      fprintf(stderr,"{debug} SetSpec %s : aSpec=%s\n", NS_FAILED(mStatus) ? "failed." : "succeeded.", l_string);
+    }
+#endif
     return *this;
   }
   NS_MutateURI& SetScheme(const nsACString& aScheme)
   {
     if (NS_FAILED(mStatus)) {
       return *this;
     }
     mStatus = mMutator->SetScheme(aScheme, nullptr);

By changing the following line

+    if (NS_FAILED(mStatus)) {

to a simple "{", you can obtain the output for successful SetSpec, too.
This gives you what are accepted URIs in the rest of the mozilla code.

I used to gather them, but since it is voluminous, now I only collect the failed URIs.

C A U T I O N:
You can only see such output in a failed test case log on try-comm-central.
The system does not show any output if the test is deemed to have succeeded.

You HAVE to run LOCAL test and use FULL DEBUG version to look at these gory details.

This would be because we of "Local Folders" in our uris :-|
Space is not valid for the hostname.

Keywords: dupeme

(In reply to Magnus Melin [:mkmelin] from comment #4)

This would be because we of "Local Folders" in our uris :-|
Space is not valid for the hostname.

Why did it begin to happen in the last couple of weeks?
Anyway, this is very troublesome.

See bug 1527462, I don't know why it started warning more. Maybe someone just added a warning since it's invalid...

(In reply to Magnus Melin [:mkmelin] from comment #6)

See bug 1527462, I don't know why it started warning more. Maybe someone just added a warning since it's invalid...

Thank you for the pointer.

I will monitor bug 1527462 because I think it is a waste of time to try to use invalid URI until we find a URI that works (it seems TB sometimes work that way).

Keywords: regression
Version: Trunk → Thunderbird 128
Blocks: tb128found
You need to log in before you can comment on or make changes to this bug.