PGO build fails with "TypeError: write() argument must be str, not bytes" with Python 3
Categories
(Firefox Build System :: Mach Core, defect, P3)
Tracking
(Not tracked)
People
(Reporter: wolfiR, Unassigned)
Details
When I try to build Firefox with PGO enabled, like:
ac_add_options MOZ_PGO=1
xvfb-run --server-args="-screen 0 1920x1080x24"
./mach build -v
it fails with the following log:
[ 5171s] 85:23.37 gmake[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/installer'
[ 5171s] 85:23.37 gmake: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented'
[ 5178s] ERROR:root:a bytes-like object is required, not 'str'
[ 5179s] Exception in thread ProcessReader:
[ 5179s] Traceback (most recent call last):
[ 5179s] File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
[ 5179s] self.run()
[ 5179s] File "/usr/lib64/python3.8/threading.py", line 870, in run
[ 5179s] self._target(*self._args, **self._kwargs)
[ 5179s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1116, in _read
[ 5179s] callback(line.rstrip())
[ 5179s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1026, in __call__
[ 5179s] e(*args, **kwargs)
[ 5179s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1168, in __call__
[ 5179s] self.stream.write(ensure(line) + ensure('\n'))
[ 5179s] TypeError: write() argument must be str, not bytes
[ 5184s] ERROR:root:a bytes-like object is required, not 'str'
[ 5187s] Exception in thread ProcessReader:
[ 5187s] Traceback (most recent call last):
[ 5187s] File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
[ 5187s] self.run()
[ 5187s] File "/usr/lib64/python3.8/threading.py", line 870, in run
[ 5187s] self._target(*self._args, **self._kwargs)
[ 5187s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1116, in _read
[ 5187s] callback(line.rstrip())
[ 5187s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1026, in __call__
[ 5187s] e(*args, **kwargs)
[ 5187s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1168, in __call__
[ 5187s] self.stream.write(ensure(line) + ensure('\n'))
[ 5187s] TypeError: write() argument must be str, not bytes
[ 5573s] jarlog: /home/abuild/rpmbuild/BUILD/obj/jarlog/en-US.log
[ 5573s] Could not find profraw files in the current directory: /home/abuild/rpmbuild/BUILD/obj/instrumented
[ 5573s] Config object not found by mach.
[ 5573s] Configure complete!
[ 5573s] Be sure to run |mach build| to pick up any changes
[ 5573s] To view resource usage of the build, run |mach resource-usage|.
[ 5573s] To take your build for a test drive, run: |mach run|
[ 5573s] For more information on what to do now, see https://developer.mozilla.org/docs/Developer_Guide/So_You_Just_Built_Firefox
[ 5573s] Error running mach:
[ 5573s]
[ 5573s] ['build', '-v']
[ 5573s]
[ 5573s] The error occurred in code that was called by the mach command. This is either
[ 5573s] a bug in the called code itself or in the way that mach is calling it.
[ 5573s] You can invoke |./mach busted| to check if this issue is already on file. If it
[ 5573s] isn't, please use |./mach busted file| to report it. If |./mach busted| is
[ 5573s] misbehaving, you can also inspect the dependencies of bug 1543241.
[ 5573s]
[ 5573s] If filing a bug, please include the full output of mach, including this error
[ 5573s] message.
[ 5573s]
[ 5573s] The details of the failure are as follows:
[ 5573s]
[ 5573s] subprocess.CalledProcessError: Command '['/home/abuild/rpmbuild/BUILD/obj/instrumented/_virtualenvs/init_py3/bin/python', '/home/abuild/rpmbuild/BUILD/firefox-77.0/build/pgo/profileserver.py']' returned non-zero exit status 1.
[ 5573s]
[ 5573s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/python/mozbuild/mozbuild/build_commands.py", line 123, in build
[ 5573s] subprocess.check_call(pgo_cmd, cwd=instr.topobjdir,
[ 5573s] File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
[ 5573s] raise CalledProcessError(retcode, cmd)
[ 5573s] error: Bad exit status from /var/tmp/rpm-tmp.v9UBsm (%build)
[ 5573s]
Comment 1•4 years ago
|
||
Does your local copy of the code have this patch applied to it? If not I might have to cherry-pick this into the 77 beta branch.
Updated•4 years ago
|
Reporter | ||
Comment 2•4 years ago
|
||
I don't have this patch but I can add it myself.
Thanks for the pointer. I guess for including it into 77 it's too late.
Comment 3•4 years ago
|
||
This is a duplicate of bug 1634646 then.
Reporter | ||
Comment 4•4 years ago
•
|
||
I've applied the patch but it still fails slightly differently:
[ 3292s] ERROR:root:a bytes-like object is required, not 'str'
[ 3294s]
[ 3294s] ###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
[ 3304s] ERROR:root:a bytes-like object is required, not 'str'
[ 3307s]
[ 3307s] (/home/abuild/rpmbuild/BUILD/obj/instrumented/dist/firefox/firefox:32499): Gtk-WARNING **: 20:47:32.958: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/bullet-symbolic.svg.
[ 3307s] This may indicate that pixbuf loaders or the mime database could not be found.
[ 3867s]
[ 3867s] ###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
[ 3867s]
[ 3870s] jarlog: /home/abuild/rpmbuild/BUILD/obj/jarlog/en-US.log
[ 3870s] Could not find profraw files in the current directory: /home/abuild/rpmbuild/BUILD/obj/instrumented
[ 3870s] Config object not found by mach.
[ 3870s] Configure complete!
[ 3870s] Be sure to run |mach build| to pick up any changes
[ 3870s] To view resource usage of the build, run |mach resource-usage|.
[ 3870s] To take your build for a test drive, run: |mach run|
[ 3870s] For more information on what to do now, see https://developer.mozilla.org/docs/Developer_Guide/So_You_Just_Built_Firefox
[ 3870s] Error running mach:
[ 3870s]
[ 3870s] ['build', '-v']
[ 3870s]
[ 3870s] The error occurred in code that was called by the mach command. This is either
[ 3870s] a bug in the called code itself or in the way that mach is calling it.
[ 3870s] You can invoke |./mach busted| to check if this issue is already on file. If it
[ 3870s] isn't, please use |./mach busted file| to report it. If |./mach busted| is
[ 3870s] misbehaving, you can also inspect the dependencies of bug 1543241.
[ 3870s]
[ 3870s] If filing a bug, please include the full output of mach, including this error
[ 3870s] message.
[ 3870s]
[ 3870s] The details of the failure are as follows:
[ 3870s]
[ 3870s] subprocess.CalledProcessError: Command '['/home/abuild/rpmbuild/BUILD/obj/instrumented/_virtualenvs/init_py3/bin/python', '/home/abuild/rpmbuild/BUILD/firefox-77.0/build/pgo/profileserver.py']' returned non-zero exit status 1.
[ 3870s]
[ 3870s] File "/home/abuild/rpmbuild/BUILD/firefox-77.0/python/mozbuild/mozbuild/build_commands.py", line 123, in build
[ 3870s] subprocess.check_call(pgo_cmd, cwd=instr.topobjdir,
[ 3870s] File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
[ 3870s] raise CalledProcessError(retcode, cmd)
[ 3870s] error: Bad exit status from /var/tmp/rpm-tmp.ivss8x (%build)
Updated•4 years ago
|
Comment 5•4 years ago
|
||
So the new problematic error happens in:
ret = runner.wait()
at line 146.
Is it possible to dump also backtrace of the Python exception?
Comment 6•4 years ago
|
||
Can please anybody help me how to debug the problem?
Comment 7•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 8•4 years ago
|
||
Hey Martin, sorry for the delay, I missed this until BugBug made it visible again :)
Are you running into the same problem as Wolfgang? Also, which file runs into the error on line 146?
FWIW, you can dump a backtrace within python by doing:
import traceback
traceback.print_stack()
Feel free to "need-info" me if you find new information or have any other questions.
Comment 9•4 years ago
|
||
All right, now I see the following:
[ 2584s] 42:29.55 gmake[6]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/branding/official/locales'
[ 2584s] 42:29.56 gmake[6]: Entering directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/branding/official/locales'
[ 2584s] 42:29.56 gmake[6]: Nothing to be done for 'libs'.
[ 2584s] 42:29.56 gmake[6]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/branding/official/locales'
[ 2584s] 42:29.56 gmake[6]: Entering directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/branding/official/locales'
[ 2584s] 42:29.56 gmake[6]: Nothing to be done for 'tools'.
[ 2584s] 42:29.56 gmake[6]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/branding/official/locales'
[ 2584s] 42:29.56 gmake[5]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/branding/official/locales'
[ 2584s] 42:29.56 gmake[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/locales'
[ 2584s] 42:29.56 gmake[4]: Entering directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/locales'
[ 2584s] 42:29.57 ../../config/nsinstall -D ../../dist/linux-x86_64/xpi/
[ 2584s] 42:29.57 /home/abuild/rpmbuild/BUILD/obj/instrumented/_virtualenvs/init_py3/bin/python -m mozbuild.action.langpack_manifest --locales en-US --min-app-ver 83.0 --max-app-ver 83.* --app-name 'Firefox' --l10n-basedir '/home/abuild/rpmbuild/BUILD/l10n' --defines /home/abuild/rpmbuild/BUILD/firefox-83.0/toolkit/locales/en-US/defines.inc /home/abuild/rpmbuild/BUILD/firefox-83.0/browser/locales/en-US/defines.inc --langpack-eid 'langpack-en-US@firefox.mozilla.org' --input ../../dist/xpi-stage/locale-en-US
[ 2585s] 42:29.75 /home/abuild/rpmbuild/BUILD/obj/instrumented/_virtualenvs/init_py3/bin/python -m mozbuild.action.zip -C ../../dist/xpi-stage/locale-en-US -x **/*.manifest -x **/*.js -x **/*.ini /home/abuild/rpmbuild/BUILD/obj/instrumented/dist/linux-x86_64/xpi/firefox-83.0.en-US.langpack.xpi chrome localization browser manifest.json
[ 2585s] 42:29.92 gmake[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/locales'
[ 2585s] 42:29.92 gmake[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/locales'
[ 2585s] 42:29.92 gmake[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/installer'
[ 2585s] 42:29.92 gmake[2]: Entering directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/installer'
[ 2585s] 42:29.92 gmake[2]: Nothing to be done for 'tools'.
[ 2585s] 42:29.92 gmake[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/installer'
[ 2585s] 42:29.92 gmake[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented/browser/installer'
[ 2585s] 42:29.92 gmake: Leaving directory '/home/abuild/rpmbuild/BUILD/obj/instrumented'
[ 2589s] console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)"))
[ 2597s] JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
[ 2597s] JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
[ 2597s] JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
[ 2597s] JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
[ 2597s] JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
[ 2597s] JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
[ 2598s]
[ 2598s] (/home/abuild/rpmbuild/BUILD/obj/instrumented/dist/firefox/firefox:31167): Gtk-WARNING **: 15:22:54.859: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/bullet-symbolic.svg.
[ 2598s] This may indicate that pixbuf loaders or the mime database could not be found.
[ 2976s] jarlog: /home/abuild/rpmbuild/BUILD/obj/jarlog/en-US.log
[ 2976s] Could not find profraw files in the current directory: /home/abuild/rpmbuild/BUILD/obj/instrumented
[ 2976s] Config object not found by mach.
[ 2976s] Configure complete!
[ 2976s] Be sure to run |mach build| to pick up any changes
[ 2976s] To view resource usage of the build, run |mach resource-usage|.
[ 2976s] To take your build for a test drive, run: |mach run|
[ 2976s] For more information on what to do now, see https://firefox-source-docs.mozilla.org/setup/contributing_code.html
[ 2976s] Error running mach:
[ 2976s]
[ 2976s] ['build', '-v']
[ 2976s]
[ 2976s] The error occurred in code that was called by the mach command. This is either
[ 2976s] a bug in the called code itself or in the way that mach is calling it.
[ 2976s] You can invoke |./mach busted| to check if this issue is already on file. If it
[ 2976s] isn't, please use |./mach busted file build| to report it. If |./mach busted| is
[ 2976s] misbehaving, you can also inspect the dependencies of bug 1543241.
[ 2976s]
[ 2976s] If filing a bug, please include the full output of mach, including this error
[ 2976s] message.
[ 2976s]
[ 2976s] The details of the failure are as follows:
[ 2976s]
[ 2976s] subprocess.CalledProcessError: Command '['/home/abuild/rpmbuild/BUILD/obj/instrumented/_virtualenvs/init_py3/bin/python', '/home/abuild/rpmbuild/BUILD/firefox-83.0/build/pgo/profileserver.py']' returned non-zero exit status 1.
[ 2976s]
[ 2976s] File "/home/abuild/rpmbuild/BUILD/firefox-83.0/python/mozbuild/mozbuild/build_commands.py", line 118, in build
[ 2976s] subprocess.check_call(pgo_cmd, cwd=instr.topobjdir,
[ 2976s] File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
[ 2976s] raise CalledProcessError(retcode, cmd)
[ 2976s] error: Bad exit status from /var/tmp/rpm-tmp.bhB33z (%build)
[ 2976s]
[ 2976s]
[ 2976s] RPM build errors:
[ 2976s] Bad exit status from /var/tmp/rpm-tmp.bhB33z (%build)
[ 2976s]
[ 2976s] marxinbox.suse.cz failed "build MozillaFirefox.spec" at Wed Dec 2 15:29:12 UTC 2020.
[ 2976s]
Comment 10•4 years ago
|
||
Hey Martin, I'm not seeing the same error described originally in this bug, so I've created a new one over here.
I've performed a PGO build on my Linux machine but I'm unable to repro just yet, would you mind answering some questions in the other bug so I can try to narrow down the cause of your issue?
Comment 11•4 years ago
|
||
I would close the bug now, it works for me with the patch from:
https://bugzilla.mozilla.org/show_bug.cgi?id=1680306#c12
Comment 12•4 years ago
|
||
Martin's issue was around PGO builds with gcc
.
Wolfgang, are you still seeing this issue on your machine?
Updated•4 years ago
|
Updated•4 years ago
|
Comment 13•4 years ago
|
||
I'm going to assume that the python error encountered was resolved.
Comment 14•4 years ago
|
||
(In reply to Mitchell Hentges [:mhentges] 🦀 from comment #13)
I'm going to assume that the python error encountered was resolved.
Yes, I would close it.
Updated•4 years ago
|
Description
•