edje_cc has non-deterministic output #41
Open
opened 2023-10-12 03:13:01 -07:00 by bmwiedemann
·
5 comments
No Branch/Tag Specified
master
devs/devilhorns/apos
v-1.27
v-1.26.0
devs/bu5hm4n/tmp
feature/themes/flat
devs/bu5hm4n/elput_with_swipe
devs/hermet/lottie
devs/billiob/imf_xim_issue
devs/felipealmeida/delivered
devs/felipealmeida/D12182
devs/felipealmeida/eapi
efl-1.25
devs/bu5hm4n/lets-annoy-travis
efl-1.24
devs/stefan/testing
devs/bu5hm4n/perf
devs/bu5hm4n/release-fix
devs/bu5hm4n/travis-macos-check
devs/bu5hm4n/compiler-plugin
devs/stefan/ci-exactness-codecov
devs/stefan/exactness-new-tests
devs/bu5hm4n/travis
devs/stefan/patch-review
devs/stefan/coverity-build
devs/stefan/coverity-run
devs/stefan/compiler-plugin-infra
devs/stefan/coverity-fixes
devs/stefan/webp-default-off
devs/stefan/exactnes-no-ftype
devs/stefan/testsuite-emotion
devs/stefan/ci-timing-stats
devs/stefan/ci-other-archs-tests
devs/stefan/revert-elm-test-so
devs/stefan/ci-efl-one
devs/bu5hm4n/work_build
devs/stefan/ci-asan
devs/stefan/mingw-cross
devs/stefan/travis-f32-mingw
devs/stefan/travis-distro-updates
devs/stefan/efl-dll
devs/stefan/ci-f32-exactness
devs/stefan/ci-fileselector
devs/zmike/buildtest
devs/stefan/lua52-fix
devs/stefan/tmp
devs/felipealmeida/fix-eina-dll-export
devs/stefan/ci-exactness
devs/stefan/exactnes-debug
devs/stefan/emotion-test-suite
devs/bu5hm4n/Test
devs/bu5hm4n/eo_file_updates
devs/bu5hm4n/fixes
devs/bu5hm4n/work_dnd
devs/bu5hm4n/travis-cnp
devs/bu5hm4n/focus_fixes
devs/xartigas/rename_text_cursor
devs/bu5hm4n/macos-fix
devs/bu5hm4n/exactness_work
devs/stefan/exactness-preload
devs/stefan/testsuite-enhancements
devs/stefan/circleci
devs/stefan/exactnes-marcel
devs/stefan/travis-more-archs
devs/bu5hm4n/eo_work
devs/bu5hm4n/work_widget
devs/bu5hm4n/work_eo_final
devs/stefan/exactness-fixes
devs/jsuya/mi_controller
devs/bu5hm4n/work_eo
devs/jaehyun/animation_manager
devs/zmike/wip
devs/stefan/osx-fix
devs/bu5hm4n/travis-try
devs/bu5hm4n/work_cnp
devs/bu5hm4n/work_spotlight_fixes
devs/stefan/travis-updates
devs/stefan/ci-macos-fix
devs/jsuya/dynamic_property_color
devs/bu5hm4n/work_spotlight
devs/bu5hm4n/work_cnp_wayland
devs/stefan/exactness-final-test
devs/stefan/ci-exactness-merged2
devs/bu5hm4n/annoying_bug
devs/stefan/exactness-merged2
devs/bu5hm4n/example
devs/stefan/exactness-merged
devs/stefan/exactness
devs/stefan/ci-updates
devs/bu5hm4n/work_multi_input
devs/stefan/ci-new-ewpi
devs/bu5hm4n/gesture_from_mike
devs/bu5hm4n/work_tests
devs/bu5hm4n/work_seperator
devs/woohyun/text_interface
devs/bu5hm4n/work_asdf
devs/stefan/ci-different-archs
devs/stefan/ci-debug-asan
devs/felipealmeida/hide-properties
devs/bu5hm4n/work_spin
efl-1.23
devs/hermet/wui
devs/bu5hm4n/work_progressbar
devs/lauromoura/D10791-indexers
devs/lauromoura/T8486-csharp-collections
devs/lauromoura/T8515-marshaler-review
devs/xartigas/eolian_mono_list_formatting
devs/lauromoura/stylecop
devs/lauromoura/dotnet-versioning
devs/bu5hm4n/work_animations
devs/lauromoura/remove_eina_mono-rebased
devs/lauromoura/CA1801
devs/devilhorns/output
devs/bu5hm4n/tab_pager_work
devs/bu5hm4n/work_spotlight2
devs/bu5hm4n/efl-eins
devs/zmike/123citest
devs/lauromoura/remove_eina_mono
devs/bu5hm4n/spotlight_work
devs/lauromoura/eolian-cpp-header-fixes
devs/bu5hm4n/animation_work
devs/felipealmeida/native-win32-build
devs/lauromoura/getter_returns
devs/lauromoura/eina-cleanup
devs/zmike/genlist
devs/lauromoura/tcautomated-squashed
devs/bu5hm4n/br0ken
devs/lauromoura/property_revamp
devs/lauromoura/tcautomated
devs/tasn/ifaces
devs/bu5hm4n/performances
devs/bu5hm4n/dead_events
devs/tasn/ifaces-with-factories
devs/zmike/122citest
efl-1.22
devs/bu5hm4n/build-try
devs/bu5hm4n/test-try
devs/bu5hm4n/header-build-test
devs/bu5hm4n/shit-stable
devs/stefan/ci-test
devs/lauromoura/default_params
devs/bu5hm4n/cv-finalize
devs/bu5hm4n/eio-fixes
devs/stefan/travis-i386
devs/lauromoura/cv-finalize-csharp
devs/bu5hm4n/build-test
devs/zmike/cv
devs/woohyun/raw_editable
devs/woohyun/remove_canvas_text
devs/lauromoura/csharp-interface-protected
devs/bu5hm4n/cv
devs/stefan/travis-notification-tweaks
devs/bu5hm4n/collectionview
devs/bu5hm4n/work
devs/bu5hm4n/arm-test
devs/bu5hm4n/work_eio
devs/bu5hm4n/items_optimize
devs/bu5hm4n/items_work
devs/lauromoura/tcautomated-rebase
devs/felipealmeida/mvvm-parts
devs/bu5hm4n/focus_optimize
devs/lauromoura/nuget
devs/bu5hm4n/work_travis
devs/bu5hm4n/work_container
devs/bu5hm4n/work_range_display
devs/bu5hm4n/buildtest
devs/bu5hm4n/beta-removal
devs/bu5hm4n/make_doc_cop_happy
devs/stefan/travis-no-default
devs/jaehyun/efl_clickable_test4
devs/bu5hm4n/work_test_efl_input_interface
devs/jaehyun/efl_clickable_test3
devs/zmike/ex
devs/lauromoura/csharp_examples
devs/jaehyun/efl_clickable_test
devs/vitorsousa/csharp_stringshare_containers
devs/felipealmeida/tctautomated
devs/vitorsousa/constructible_eflsharp
devs/devilhorns/evas_inline
devs/devilhorns/flip
devs/vitorsousa/pin-unpin
devs/zmike/win
devs/lauromoura/pin-unpin
devs/vitorsousa/eo_ownership_events
devs/felipealmeida/eo_ownership_optimization_test
devs/felipealmeida/pin-unpin
devs/lauromoura/csharp_conventions
devs/vitorsousa/csharp_end_error_fix
devs/lauromoura/csharp_application
devs/devilhorns/rotation
devs/q66/remove-eo-api-support-macro
devs/lauromoura/interface_events
devs/devilhorns/evas_drm
devs/felipealmeida/mono_model
devs/q66/check-betaness-everywhere
devs/q66/remove-generated-legacy-includes
devs/q66/eolian-remove-legacy
devs/q66/legacy-eo-headers
devs/q66/eolian-beta-types
devs/q66/eolian-inlist-inarray
devs/devilhorns/multi-output
devs/stanluk/access_refactor
devs/jackdanielz/exactness
devs/lauromoura/csharp_api_dump
devs/felipealmeida/dotnet-core
devs/larrylira/treeview
devs/lauromoura/eolian-inlist-inarray
devs/larrylira/listfix
devs/stanluk/mixin_removal
devs/felipealmeida/interface_inherit
devs/vitorsousa/inout_rw_slice_amended
devs/lauromoura/inout_rw_slice
devs/stanluk/composite
devs/stanluk/standalone
devs/bu5hm4n/c-sharp-on-system
devs/lauromoura/app_poc
devs/herdsman/staging
devs/larrylira/viewtree
devs/devilhorns/elput
devs/lauromoura/coroutines
devs/vitorsousa/model_composite
devs/q66/eolian_inherit_api
devs/herdsman/next
devs/herdsman/text/ui_text_theme
efl-1.21
devs/q66/eolian_mstring_freefunc
devs/bu5hm4n/eo-event-rewrite
devs/q66/eolian_aux
devs/jaehyun/efl_ui_theme
devs/q66/eolian_deps
devs/stanluk/fix
devs/larrylira/testgen
devs/beber/master
devs/felipealmeida/tct
devs/herdsman/text/efl_ui_text
devs/discomfitor/122citest
devs/discomfitor/release-test
devs/sanghyeonlee/efl_ui_grid
devs/discomfitor/citest
devs/discomfitor/citest-meson
devs/felipealmeida/makefile-examples
devs/discomfitor/meson
devs/discomfitor/xfixes
devs/discomfitor/osxtest
devs/felipealmeida/csharp-new-classes
devs/q66/elua_enable
devs/ajwillia-ms/elm_code_wrap
devs/larrylira/factory
devs/derekf/build_fix
devs/discomfitor/testinggg
devs/discomfitor/ci-make-check
devs/herdsman/debug/evas_font_debug
devs/discomfitor/simple-efreet-fix
devs/discomfitor/pending
devs/herdsman/edje_part_next
devs/larrylira/modelfix
efl-1.20
devs/discomfitor/test
devs/derekf/wayland
feature/security
feature/wayland/multi-output
devs/conr2d/import_edj
devs/jaehyun/efl_part_legacy_remove_final
devs/woohyun/elm_widget_focus
devs/stefan/sonar-test
devs/jaehyun/efl_part_legacy_remove2
devs/eunue/pager
devs/jaehyun/efl_part_legacy_remove
devs/felipealmeida/automatedtests
devs/ami/theme-signal-renaming
devs/jaehyun/efl_ui_datetime
devs/derekf/no_more_manual_render
devs/jaehyun/efl_ui_naviframe
devs/subhransu/ssg
devs/felipealmeida/cxx-lower-case
devs/discomfitor/thread
feature/meson
devs/discomfitor/void
devs/ami/slider_range
devs/felipealmeida/gendoc-mono
devs/discomfitor/flat
devs/discomfitor/wipp
devs/felipealmeida/eolian-merge-test
devs/discomfitor/wip
devs/discomfitor/quicklaunch
devs/jpeg/efl_invalidate
devs/larrylira/efl_ui_list
devs/devilhorns/wip
devs/ami/pb_test
devs/discomfitor/6640
devs/lauromoura/csharp-win
devs/felipealmeida/rewrite-js
devs/herdsman/annotation_item_staging
devs/ami/color
devs/jpeg/no_null_calls
devs/taxi2se/efl_playable
devs/jayji/perfs
devs/thiep/cop
devs/stanluk/split3
devs/jpeg/osx
devs/stanluk/adaptor
devs/stanluk/split2
devs/herdsman/annotation_item
devs/jpeg/shadow
devs/felipealmeida/efl-ui-list
devs/jaehyun/efl_popup_alert_scroll
devs/jpeg/eo_theme
devs/stanluk/split
devs/netstar/elm_code_alpha
devs/ami/scale_fix
devs/jpeg/item_widget_model
devs/felipealmeida/csharp
devs/jpeg/cxx
devs/jaehyun/efl_popup
devs/jaehyun/efl_popup_test
devs/woohyun/efl_ui_toolbar
devs/raster/theme/flat2
devs/netstar/elm_code_from_theme
devs/jaehyun/efl_popup_test2
devs/jaehyun/efl_spinner
devs/jaehyun/efl_popup_list
devs/subhransu/scenegraph
devs/herdsman/object_factory
devs/sanghyeonlee/list_scroll
devs/subhransu/glvg
devs/jpeg/items
devs/subhransu/evas_vg
devs/subhransu/font
devs/subhransu/vector_work
devs/woohyun/ui_property
devs/herdsman/edje_text_to_textblock
devs/subhransu/clippath
devs/lorddrew/edcref_fix
devs/discomfitor/stable
devs/jpeg/genlist_crazy
devs/eunue/interface
devs/felipealmeida/efl-ui-list-segarray
devs/jaehyun/efl_mbe
devs/subhransu/gesture
devs/jpeg/work
devs/felipealmeida/wip-selection
devs/barbieri/coroutines
devs/barbieri/future
devs/woohyun/ui_scrollable
devs/felipealmeida/efl_ui_list
efl-1.19
devs/herdsman/elm_textblock
devs/thiep/size
devs/felipealmeida/efl_ui_list_new
devs/kimcinoo/work
devs/woohyun/focus_tests
devs/herdsman/tmp
devs/thiep/size.test
devs/thiep/top
devs/felipealmeida/csharp-rebase
devs/felipealmeida/csharp-norebase
devs/discomfitor/rotation
efl-1.18
devs/stanluk/refactor2
devs/lauromoura/js
devs/eunue/scrollable
devs/stanluk/refactor
devs/q66/eolian_units
devs/devilhorns/planes
devs/barbieri/efl_net_socket_windows2
devs/eunue/panel
devs/conr2d/observer
devs/jayji/kludge
devs/barbieri/efl_net_socket_windows
devs/iscaro/edje-deps
devs/yoz/wip
devs/lauromoura/js-1.18
devs/devilhorns/drm_evas_devices
devs/felipealmeida/efl_ui_connect
devs/barbieri/cmake
devs/jeyzu/mtests
devs/sung/evas_gl_thread
devs/barbieri/jenkins
efl-1.16
devs/lorddrew/edje_edit_in_memory
devs/jayji/ecore-getopt
devs/felipealmeida/csharp-prototype
devs/vitorsousa/failing_future_all
devs/q66/eolian_gen_next
devs/jayji/sierra
devs/vitorsousa/T4502
devs/devilhorns/atomic
efl-1.8
efl-1.9
efl-1.10
efl-1.11
efl-1.12
efl-1.13
efl-1.14
efl-1.15
efl-1.17
devs/vitorsousa/update_event_calls
devs/vitorsousa/fix_fileselector
devs/vitorsousa/strict_events
devs/felipealmeida/promises-cxx
devs/devilhorns/framespace
devs/felipealmeida/js-next
devs/felipealmeida/layout_connect
devs/felipealmeida/model_connect_last
devs/devilhorns/input_suspend
devs/jpeg/lambdapp
devs/felipealmeida/model_eina_container
devs/sanghyeonlee/interface
devs/cedric/uri
devs/felipealmeida/boolean-model
devs/felipealmeida/ejson-model
devs/captainigloo/eglfs_rpi
devs/devilhorns/ecore_drm2
devs/jpeg/efl_part
devs/felipealmeida/eio-eo
devs/felipealmeida/cxx-examples
devs/youngbok/elm_interface_next
devs/jayji/osx-notifications
devs/devilhorns/stable-test
devs/felipealmeida/promises
devs/jayji/fixes
devs/felipealmeida/remove_base
devs/captainigloo/eglfs
devs/jypark/work
devs/jpeg/dithering
devs/felipealmeida/eio_model-promises
devs/stefan/testsuite-new-tests
devs/felipealmeida/eo4
devs/devilhorns/ecore_libinput
devs/felipealmeida/js
devs/felipealmeida/js-20151219
devs/felipealmeida/mvc
devs/discomfitor/xdg-shedsmanship
devs/devilhorns/ecore_wl2
devs/captainigloo/osx
devs/captainigloo/win32
devs/devilhorns/evas_gl_drm
devs/felipealmeida/ecordova
devs/felipealmeida/eo_optimisations
devs/felipealmeida/uv-tizen_3.0.2015.q2_common
devs/spacegrapher/evasgl
devs/billiob/textgrid_bolditalic
devs/tasn/q66
devs/felipealmeida/data-models-push
devs/felipealmeida/datamodels
devs/felipealmeida/next
devs/herdsman/tb_add_decorate_debug_api
devs/felipealmeida/unwind
devs/devilhorns/evas_wayland_shm
devs/felipealmeida/esoap-model
devs/felipealmeida/eina-optional
devs/avilog/adding_eolian_info
devs/avilog/replace_smart_callbacks_with_eo
devs/felipealmeida/js-vinicius
devs/felipealmeida/emodel_tizen
devs/spacegrapher/evasgl-1.14
devs/vitorsousa/beta_error_eoliancxx
devs/cedric/ecore_con_ssh
devs/tasn/part_get
devs/avilog/callbacks_by_counterpart
devs/devilhorns/ecore_drm
devs/avilog/callbacks_by_events
devs/felipealmeida/emodel
devs/avilog/callbacks_by_hashed_events
devs/felipealmeida/cxx_gen_fix
devs/b.devichev/model_save_load
devs/tasn/tb2
devs/eunue/evas_masking
devs/bluezery/doc
devs/felipealmeida/clang_x64_test
devs/captainigloo/doc
devs/tasn/eo_fix
devs/cedric/evas_tiling
devs/devilhorns/ecore_input
devs/devilhorns/xdg_shell
devs/raoul/macos_port
devs/devilhorns/drm
devs/jeyzu/eo2
devs/jeyzu/eo2-next
devs/lucas/fix-eina-newfuncs
devs/antognolli/subsurfaces2
devs/jeyzu/eo2-old
devs/asdfuser/edje_tests
devs/asdfuser/jenkins
devs/asdfuser/ecore_audio_eo
devs/jeyzu/eina-api
devs/devilhorns/wayland
devs/asdfuser/ecore_audio
devs/devilhorns/wayland_egl
v-1.27.0
v1.26.3
Labels
Clear labels
No items
No Label
Milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Clear assignees
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: enlightenment/efl#41
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While working on reproducible builds for openSUSE, I found that our
efl
1.26.3 andenlightenment-theme-openSUSE
packages varied in.edj
files, even when trying to vary as little as possible.A similar previous issue was fixed in commit
4d2117ef2a
Steps to reproduce (in the openSUSE package after build):
Actual results:
Running the loop 100 times produces 14 different results. This suggests that at least 4 bits of entropy are involved. There is a 6+% chance to get two identical results by chance.
Expected results:
output should be deterministic, so only change when inputs change.
There seems to be some issue with ordering when looking at the diff:
You won't be able to make it reproducable. Why?
edje_cc uses async threaded loading of image assets and will pack them into the target file as the threads report completion. This is a core feature of evas that is ued many places to keep decode out of the main loop to stall it on that I/O.
Edje_cc also has other threaded encode/compress passes for data blobs too which will do the same thing. Spawn a bunch of worker threads to compress things in parallel. The source blobs in your diff above are packed into the file for decompile purposes and... guess what? They are compressed (to keep the edj file from being too insanely big) and are compressed ... in threads. So there will be non-deterministic creation of the content of the file simply due to timing of scheduling of these threads. All edje cares about is that all the data is actually there and it is encoded right and can be decoded right.
So going to have to close. It's coded to try be faster to compile, not deterministic.
I want to mention here that
xz -T
andzstd -T
andpigz
all do threaded compression while being able to produce deterministic results.I did not look into how they do it, but could imagine that they collects results in a specific order.
Also,
edje_cc
was non-deterministic on 1-core VMs where there is no advantage in using extra threads.I had some more looks into the source and something is wrong there.
4cea33945d/src/bin/edje/edje_cc.c (L50)
says the default isthreads = 0
but the help text in line 136 suggests that
-threads
is the default, which would bethreads = 1
.Then there are 22 instances of
if (threads)
inedje_cc_out.c
that should prevent the use of threads, but strace showed that it still calls theclone
syscall 276 times to create as many threads. So at least the-nothreads
param is broken.This is not like tar.gz where a tar file is compressed as one unit. edj files areeet files. these have each chunk of data compressed as a separate unit so it can be random-accessed and decompressed on the fluy without decompressing everything up until that point. that means that each key in th edj file (about 6000-7000 of them for the default theme) is throwing into a work queue and compressed on a set of threads which assemble the results when the compression finishes for each key/chunk as eet files (edje uses eet) are built like:
{header}{list-of-keys}{data1}{data2}{data3}...
so list-of-keys doesnt know where data2 will be (offset from that) until data1 is compressed and so on. it assigns a spot when the data comes in from compression.
and it'll still spawn threads to compress AND it'll still use threads to load/decode imagess from disk even with only 1 core. as each image decode comes back from the thread(s) doing the decode it will THEN be put onto the work queue to encode (compress) as above. in addition to all the other data chunks. so async preload alone will alter ordering. in addition to threaded encode. the threads option only affects this latter step. async loading of images is always done via evas and evas always uses threads for this.
I still think, it should be possible to do that in a deterministic way.
It could be more like individual .gz files in a .tar or .cpio to allow random access.
Would you accept a patch that ensured determistic output order?