Last Comment Bug 516667 - Mozilla Firefox Cannot add bookmarks on AIX platform
: Mozilla Firefox Cannot add bookmarks on AIX platform
Status: RESOLVED FIXED
: verified1.9.0.19, verified1.9.1, verified1.9.2
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: Other AIX
: -- major (vote)
: mozilla1.9.3a1
Assigned To: Shailen
:
: Nathan Froyd [:froydnj]
Mentors:
: 523063 (view as bug list)
Depends on: 535894
Blocks: 537588
  Show dependency treegraph
 
Reported: 2009-09-15 01:57 PDT by Shailen
Modified: 2011-01-15 20:59 PST (History)
14 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
.2-fixed
.9-fixed


Attachments
Patch V 1 (2.80 KB, patch)
2009-09-15 05:56 PDT, Shailen
mak77: review-
Details | Diff | Splinter Review
Javascript debugger screenshots (637.00 KB, application/msword)
2009-09-16 02:09 PDT, Shailen
no flags Details
Patch V 2 (1.85 KB, patch)
2009-12-19 02:40 PST, Shailen
gal: review+
benjamin: superreview+
Details | Diff | Splinter Review
Cleaned to Comment #26 (1.80 KB, patch)
2010-01-21 05:44 PST, Uli Link (:ul-mcamafia)
mbeltzner: approval1.9.2.2+
mbeltzner: approval1.9.1.9+
mbeltzner: approval1.9.0.19+
Details | Diff | Splinter Review

Description Shailen 2009-09-15 01:57:36 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3

With Mozilla firefox 3 on AIX platform,  when I click on 'Bookmarks->Bookmark This Page' ti shows me below error.

JavaScript error: , line 0: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsITransactionManager.doTransaction]"  nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"  location: "JS frame :: file:///home/firefox/dbg/mozilla/obj-opt/dist/bin/components/nsPlacesTransactionsService.js :: doTransaction :: line 190"  data: no]


I debugged this further and found the below.

In  chrome://browser/content/browser.js, there are 2 lines as below
1.     var txn = PlacesUIUtils.ptm.createItem(uri, parent, -1,title, null, [descAnno]);
2.    PlacesUIUtils.ptm.doTransaction(txn);

I stepped inside at line#1 and it takes me to nsPlacesTransactionsService.js at the below lines

3. createItem: function placesCrtItem(aURI, aContainer, aIndex, aTitle, aKeyword, aAnnotations, aChildTransactions) {
4.     return new placesCreateItemTransactions(aURI, aContainer, aIndex, aTitle,aKeyword, aAnnotations, aChildTransactions);
5.  },


At line# 4, I examined whether the value returned is null or not and it shows that it is not null.
 
But when the value is returned to line#1 of browser.js, it is null.
Hence the line#2 of browser.js is resulting in an error saying Invaid pointer.

Can someone please advise what could be the reason for not getting the return value for 'txn' in chrome://browser/content/browser.js ?

Thanks,
Shailendra

Reproducible: Always

Steps to Reproduce:
1. Build Mozilla Firefox 3.6a1pre build on AIX with Gnome RPMS of 64 bit
version.
2.
3.
Actual Results:  
Build gives the above error.


Expected Results:  
Build should be able to add the new boomkark
Comment 1 Shailen 2009-09-15 05:56:23 PDT
Created attachment 400748 [details] [diff] [review]
Patch V 1

This is not a patch but this workaround helps adding the bookmark.

Can you please advise as what would be the reason for not getting the return value in browser.js
Comment 2 Shailen 2009-09-16 02:09:06 PDT
Created attachment 400973 [details]
Javascript debugger screenshots

I have added few java debugger screen shots.
Comment 3 Marco Bonardo [::mak] 2009-09-16 03:16:52 PDT
Comment on attachment 400748 [details] [diff] [review]
Patch V 1

Sorry but clearly we can't take this workaround, this really looks like a platform issue, and could be related to tracemokey.

If i'd accept this workaround we should do the same everywhere, polluting the global space with any sort of vars.
Comment 4 Marco Bonardo [::mak] 2009-09-16 03:21:53 PDT
cc-ing someone who could help understanding what's up and if this is a JS or tracemonkey issue for this specific platform.
Comment 5 Shailen 2009-09-16 05:55:26 PDT
Also this issue is happening with Mozilla Firefox 3.0.14 as well.

I believe tracemonkey was introduced in Mozilla Firefox 3.5 onwards.
Comment 6 Shailen 2009-10-22 02:28:26 PDT
I guess I have narrowed down the problem to below.

       Captured values for dispatchParams as below before returning from the function PrepareAndDispatch() in xptcstubs_ppc_aix64.cpp,
-----------------------------------------------------------------------------

(dbx) p dispatchParams[0]
(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4594144240, u8 = '\0', u16 = 0, u32 = 1, u64 = 4594144240, f = 1.40129846e-45, d = 2.2698088410234428e-314, b = 1, c = '\0', wc = 0, p = 0x0000000111d513f0))
(dbx) p dispatchParams[1]
(val = (i8 = 0, i16 = 0, i32 = 0, i64 = 2, u8 = '\0', u16 = 0, u32 = 0, u64 = 2, f = 0.0, d = 9.8813129168249309e-324, b = 0, c = '\0', wc = 0, p = 0x0000000000000002))
(dbx) p dispatchParams[2]
(val = (i8 = -1, i16 = -1, i32 = -1, i64 = -1, u8 = '\377', u16 = 65535, u32 = 4294967295, u64 = 18446744073709551615, f = -NaNQ, d = -NaNQ, b = -1, c = '\377', wc = 65535, p = 0xffffffffffffffff))
(dbx) p dispatchParams[3]
(val = (i8 = 15, i16 = 4095, i32 = 268435455, i64 = 1152921504606829568, u8 = '^O', u16 = 4095, u32 = 268435455, u64 = 1152921504606829568, f = 2.52435475e-29, d = 1.2882297539169369e-231, b = 268435455, c = '^O', wc = 4095, p = 0x0fffffffffffbc00))
(dbx) p dispatchParams[4]
(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4571052720, u8 = '\0', u16 = 0, u32 = 1, u64 = 4571052720, f = 1.40129846e-45, d = 2.2584001142811867e-314, b = 1, c = '\0', wc = 0, p = 0x000000011074bab0))
(dbx) p dispatchParams[5]
(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4599071568, u8 = '\0', u16 = 0, u32 = 1, u64 = 4599071568, f = 1.40129846e-45, d = 2.2722432645140344e-314, b = 1, c = '\0', wc = 0, p = 0x0000000112204350))
(dbx) p dispatchParams[6]
(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4599071952, u8 = '\0', u16 = 0, u32 = 1, u64 = 4599071952, f = 1.40129846e-45, d = 2.2722434542352424e-314, b = 1, c = '\0', wc = 0, p = 0x00000001122044d0))
(dbx) p dispatchParams[7]
(val = (i8 = 15, i16 = 4095, i32 = 268435455, i64 = 1152921504606829568, u8 = '^O', u16 = 4095, u32 = 268435455, u64 = 1152921504606829568, f = 2.52435475e-29, d = 1.2882297539169369e-231, b = 268435455, c = '^O', wc = 4095, p = 0x0fffffffffffbc00))

Similarly captured values for dispatchParams after the function call  NS_InvokeByIndex() in js/src/xpconnect/src/xpcwrappednative.cpp as below.
---------------------------------------------------------------------------

(dbx)  p dispatchParams[0]
    nsXPTCMiniVariant:(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4594144240, u8 = '\0', u16 = 0, u32 = 1, u64 = 4594144240, f = 1.40129846e-45, d = 2.2698088410234428e-314, b = 1, c = '\0', wc = 0, p = 0x0000000111d513f0))
(ptr = 0x00000001104917a4, type =
            XPTTypeDescriptorPrefix:(flags = '\222')
        (),
 flags = '^D')
(dbx)  p dispatchParams[1]
    nsXPTCMiniVariant:(val = (i8 = 0, i16 = 0, i32 = 0, i64 = 2, u8 = '\0', u16 = 0, u32 = 0, u64 = 2, f = 0.0, d = 9.8813129168249309e-324, b = 0, c = '\0', wc = 0, p = 0x0000000000000002))
(ptr = 0x09000000068e5468, type =
            XPTTypeDescriptorPrefix:(flags = '^C')
        (),
 flags = '\0')
(dbx)  p dispatchParams[2]
    nsXPTCMiniVariant:(val = (i8 = -1, i16 = -1, i32 = -1, i64 = -1, u8 = '\377', u16 = 65535, u32 = 4294967295, u64 = 18446744073709551615, f = -NaNQ, d = -NaNQ, b = -1, c = '\377', wc = 65535, p = 0xffffffffffffffff))
(ptr = 0x09000000067f4cc0, type =
            XPTTypeDescriptorPrefix:(flags = '^C')
        (),
 flags = '\0')
(dbx)  p dispatchParams[3]
    nsXPTCMiniVariant:(val = (i8 = 15, i16 = 4095, i32 = 268435455, i64 = 1152921504606829568, u8 = '^O', u16 = 4095, u32 = 268435455, u64 = 1152921504606829568, f = 2.52435475e-29, d = 1.2882297539169369e-231, b = 268435455, c = '^O', wc = 4095, p = 0x0fffffffffffbc00))
(ptr = 0x09001000a0ba4708, type =
            XPTTypeDescriptorPrefix:(flags = '\271')
        (),
 flags = '^P')
(dbx)  p dispatchParams[4]
    nsXPTCMiniVariant:(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4571052720, u8 = '\0', u16 = 0, u32 = 1, u64 = 4571052720, f = 1.40129846e-45, d = 2.2584001142811867e-314, b = 1, c = '\0', wc = 0, p = 0x000000011074bab0))
(ptr = 0x0fffffffffffb6c0, type =
            XPTTypeDescriptorPrefix:(flags = '\271')
        (),
 flags = '^P')
(dbx)  p dispatchParams[5]
    nsXPTCMiniVariant:(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4599071568, u8 = '\0', u16 = 0, u32 = 1, u64 = 4599071568, f = 1.40129846e-45, d = 2.2722432645140344e-314, b = 1, c = '\0', wc = 0, p = 0x0000000112204350))
(ptr = 0x00000005ffffffff, type =
            XPTTypeDescriptorPrefix:(flags = '\222')
        (),
 flags = '^D')
(dbx)  p dispatchParams[6]
    nsXPTCMiniVariant:(val = (i8 = 0, i16 = 0, i32 = 1, i64 = 4599071952, u8 = '\0', u16 = 0, u32 = 1, u64 = 4599071952, f = 1.40129846e-45, d = 2.2722434542352424e-314, b = 1, c = '\0', wc = 0, p = 0x00000001122044d0))
(ptr = 0x0000000111aa1471, type =
            XPTTypeDescriptorPrefix:(flags = '\222')
        (),
 flags = '^D')
(dbx)  p dispatchParams[7]
    nsXPTCMiniVariant:(val = (i8 = 0, i16 = 0, i32 = 0, i64 = 0, u8 = '\0', u16 = 0, u32 = 0, u64 = 0, f = 0.0, d = 0.0, b = 0, c = '\0', wc = 0, p = (nil)))
(ptr = 0x0fffffffffffb690, type =
            XPTTypeDescriptorPrefix:(flags = '\222')
        (),
 flags = '^E')

The return value is set to 'null' as the dispatchParams[7] is having 'null' values after making call to NS_InvokeByIndex() as shown above.

Couple of things that I noted here is that

   1. dispatchParams[7] was not null before returning from PrepareAndDispatch()

   2. dispatchParams[3] and dispatchParams[7] values are exactly same.

Can someone please advise ?

Thanks,
Shailendra
Comment 7 Uli Link (:ul-mcamafia) 2009-10-28 01:44:51 PDT
Did you compile with optimization?
If yes, did you used the -qalias=noansi flag?
Comment 8 Shailen 2009-10-28 03:07:13 PDT
Yes I compiled with optimization. Also I did use the -qalias=noansi flag
Comment 9 Uli Link (:ul-mcamafia) 2009-11-23 04:24:21 PST
I ran into a similar JavaScript error with Seamonkey 2.0 source.
No optimization at all, a full debug build in 32bit.
So xptcstubs_ppc_aix64.cpp isn't used at all, but xptcstubs_ppc_aix.cpp instead.
Comment 10 Shailen 2009-12-19 02:40:18 PST
Created attachment 418493 [details] [diff] [review]
Patch V 2

The complete patch for both 64-bit and 32-bit. This resolves the adding bookmark issue on AIX platform
Comment 11 Uli Link (:ul-mcamafia) 2009-12-19 06:29:35 PST
Can you fix the issue the stubs for using -qobjmodel=ibm too?
I guess they have similiar issues.
Comment 12 Luke Wagner [:luke] 2009-12-19 13:16:51 PST
Incredible job tracking that down!  Unfortunately, I have little xpcom knowledge  and should not be the reviewer for this patch.
Comment 13 Uli Link (:ul-mcamafia) 2009-12-20 08:12:03 PST
Those files patched by https://bugzilla.mozilla.org/attachment.cgi?id=418493 only affect building on AIX with IBM XLC compiler. No other platforms hit in any way.

At the moment I'm building a Firefox 3.0.16 on AIX 5.1 / IBM XLC 7.0.0.10 for testing/confirming Shailen's patch. Even if I don't understand what incrementing those two numbers by 24 in the 32bit assembly unit and 32 in the 64bit unit actually does. But I can confirm the bug without the patch.
Comment 14 Andreas Gal :gal 2009-12-20 11:03:46 PST
Comment on attachment 418493 [details] [diff] [review]
Patch V 2

Not that I know much about this but this code either, but we don't ship on AIX.
Comment 15 Andreas Gal :gal 2009-12-20 11:07:32 PST
Crowder, this looks related to the bug we were chasing on arm (just fyi).
Comment 16 Andreas Gal :gal 2009-12-20 11:09:15 PST
A comment what the patch really does would be nice, btw. We had a similar issue on arm so I am assuming we started using more arguments and that overrun some arguments area.
Comment 17 Brian Crowder 2009-12-20 11:19:11 PST
Andreas:  Yeah, likely we've got a similar issue with our pointer-math on ARM.  :(
Comment 18 Uli Link (:ul-mcamafia) 2009-12-20 11:42:53 PST
(In reply to comment #10)
> Created an attachment (id=418493) [details]
> Patch V 2
> 
> The complete patch for both 64-bit and 32-bit. This resolves the adding
> bookmark issue on AIX platform

I can verify this patch works with Firefox 3.0.16 compiled from CVS on AIX 5.1ML9 with IBM XLC/C++ 7.0.0.10 as 64bit app and it is the first Firefox 3.0.x I've compiled without any issues. Next a 32bit build to follow...
Comment 19 Uli Link (:ul-mcamafia) 2009-12-20 15:51:02 PST
> I can verify this patch works with Firefox 3.0.16 compiled from CVS on AIX
> 5.1ML9 with IBM XLC/C++ 7.0.0.10 as 64bit app and it is the first Firefox 3.0.x
> I've compiled without any issues. Next a 32bit build to follow...

The 32bit build works flawlessly, too. THX Shailen for this patch :-)
Comment 20 Benjamin Smedberg [:bsmedberg] 2009-12-21 05:37:25 PST
moa=me, FWIW!
Comment 21 Uli Link (:ul-mcamafia) 2009-12-21 06:30:55 PST
Related or follow up to https://bugzilla.mozilla.org/show_bug.cgi?id=275004
Comment 22 Shailen 2009-12-22 00:18:18 PST
Can this patch be added to 1.9.0 and 1.9.1 branches ?
Comment 23 Uli Link (:ul-mcamafia) 2009-12-23 07:20:06 PST
Plz push to this patch to the stable branches after approval.

Risc: 
 None for any platforms except AIX as the touched files aren't used for anything but AIX. This patch is a must have for AIX, if not in the repository this patch must be applied locally. Over the last 2 or 3 years I'm not aware of other porting efforts to AIX except Shailen's for 64bit and mine for 32bit.

Benefit: 
 Stable port for AIX is available, so the AIX platform has a secure Web browser for the first time since Firefox 2.0.0.20 with reproducable build instructions.

 If the patch is applied locally I have to contribute the local patch together with the build instructions. The other porting hunks in the combined patch are more or less straightforward, but this one is very hard/impossible to understand/evaluate/trust.
Comment 24 Uli Link (:ul-mcamafia) 2009-12-27 03:23:53 PST
I can confirm that https://bugzilla.mozilla.org/attachment.cgi?id=418493 also works fine on AIX 4.3.3ML11 with the old VisualAge C++ 6.0 compiler.
Comment 25 Reed Loden [:reed] (use needinfo?) 2009-12-30 19:22:02 PST
Andreas isn't an XPCOM peer, according to http://www.mozilla.org/about/owners.html#xpcom, so removing checkin-needed until bsmedberg can review.
Comment 26 Dão Gottwald [:dao] 2010-01-21 04:20:32 PST
The patch doesn't apply cleanly.
Comment 27 Uli Link (:ul-mcamafia) 2010-01-21 05:44:23 PST
Created attachment 422729 [details] [diff] [review]
Cleaned to Comment #26

Recreated the patch by locally applying Shailen's patch and then "hg diff -U8 -p"
Comment 28 Dão Gottwald [:dao] 2010-02-04 06:06:14 PST
http://hg.mozilla.org/mozilla-central/rev/3655cb58d2cc
Comment 29 Uli Link (:ul-mcamafia) 2010-02-04 06:40:58 PST
Comment on attachment 422729 [details] [diff] [review]
Cleaned to Comment #26

Risc: None for any platform except AIX as the patched sources are not used at all by any other platform.

This patch is well tested on AIX with IBM compilers from 6.0 through 10.1 and from AIX 4.3.3, 5.1, 5.2 and 5.3, AIX 5.x 32- and 64bit.
Comment 30 Mike Beltzner [:beltzner, not reading bugmail] 2010-02-22 10:16:59 PST
Comment on attachment 422729 [details] [diff] [review]
Cleaned to Comment #26

a=beltzner for 1.9.2.2, 1.9.1.9, 1.9.0.19
Comment 32 :Gavin Sharp [email: gavin@gavinsharp.com] 2010-03-08 11:25:03 PST
https://hg.mozilla.org/releases/mozilla-1.9.1/rev/b38043e20dce
mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s.m4 	1.2
mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s.m4 	1.2
Comment 33 Sangeeth 2011-01-15 20:59:42 PST
*** Bug 523063 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.