Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CRASH] Unable to start redis-server on Apple Silicon M1 as non-root #8062

Closed
nw-b opened this issue Nov 18, 2020 · 28 comments · Fixed by #8150
Closed

[CRASH] Unable to start redis-server on Apple Silicon M1 as non-root #8062

nw-b opened this issue Nov 18, 2020 · 28 comments · Fixed by #8150

Comments

@nw-b
Copy link

nw-b commented Nov 18, 2020

Crash report

Paste the complete crash log between the quotes below. Please include a few lines from the log preceding the crash report to provide some context.

nick@nicks-mba bin % redis-server
4428:C 17 Nov 2020 21:38:11.216 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4428:C 17 Nov 2020 21:38:11.216 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=4428, just started
4428:C 17 Nov 2020 21:38:11.216 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
4428:M 17 Nov 2020 21:38:11.218 * Increased maximum number of open files to 10032 (it was originally set to 256).

=== REDIS BUG REPORT START: Cut & paste starting from here ===
4428:M 17 Nov 2020 21:38:11.221 # Redis 6.0.9 crashed by signal: 11, si_code: 2
4428:M 17 Nov 2020 21:38:11.221 # Crashed running the instruction at: 0x7fff203b9430
4428:M 17 Nov 2020 21:38:11.221 # Accessing address: 0x306018000
4428:M 17 Nov 2020 21:38:11.221 # Killed by PID: 0, UID: 0
4428:M 17 Nov 2020 21:38:11.221 # Failed assertion: <no assertion failed> (<no file>:0)

------ STACK TRACE ------
EIP:
0   libsystem_platform.dylib            0x00007fff203b9430 _platform_memset$VARIANT$Rosetta + 108

Backtrace:
0   redis-server                        0x0000000100eecbb7 logStackTrace + 110
1   redis-server                        0x0000000100eecfd5 sigsegvHandler + 271
2   libsystem_platform.dylib            0x00007fff203b6d7d _sigtramp + 29
3   libsystem_malloc.dylib              0x00007fff2019c7aa tiny_free_no_lock + 1116
4   redis-server                        0x0000000100f3d0c3 luaD_call + 97
5   ???                                 0x0000000032aaaba2 0x0 + 850045858

------ INFO OUTPUT ------
# Server
redis_version:6.0.9
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:ec508acaad782189
redis_mode:standalone
os:Darwin 20.1.0 x86_64
arch_bits:64
multiplexing_api:kqueue
atomicvar_api:atomic-builtin
gcc_version:4.2.1
process_id:4428
run_id:fc5670f4b55a97402bd9c0257ddf857c0f4879c7
tcp_port:6379
uptime_in_seconds:0
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:11831571
executable:/usr/local/Cellar/redis/6.0.9/bin/redis-server
config_file:
io_threads_active:0

# Clients
connected_clients:0
client_recent_max_input_buffer:0
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0

# Memory
used_memory:1018304
used_memory_human:994.44K
used_memory_rss:0
used_memory_rss_human:0B
used_memory_peak:1018304
used_memory_peak_human:994.44K
used_memory_peak_perc:inf%
used_memory_overhead:0
used_memory_startup:0
used_memory_dataset:1018304
used_memory_dataset_perc:100.00%
allocator_allocated:0
allocator_active:0
allocator_resident:0
total_system_memory:17179869184
total_system_memory_human:16.00G
used_memory_lua:37888
used_memory_lua_human:37.00K
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:nan
allocator_frag_bytes:0
allocator_rss_ratio:nan
allocator_rss_bytes:0
rss_overhead_ratio:nan
rss_overhead_bytes:0
mem_fragmentation_ratio:nan
mem_fragmentation_bytes:0
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:0
mem_aof_buffer:0
mem_allocator:libc
active_defrag_running:0
lazyfree_pending_objects:0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1605667091
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0

# Stats
total_connections_received:0
total_commands_processed:0
instantaneous_ops_per_sec:0
total_net_input_bytes:0
total_net_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
expire_cycle_cpu_milliseconds:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
tracking_total_keys:0
tracking_total_items:0
tracking_total_prefixes:0
unexpected_error_replies:0
total_reads_processed:0
total_writes_processed:0
io_threaded_reads_processed:0
io_threaded_writes_processed:0

# Replication
role:master
connected_slaves:0
master_replid:46fd7b1f73d20d31809d463ca9fa6e83dd8544ff
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:0.007195
used_cpu_user:0.014509
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000

# Modules

# Commandstats

# Cluster
cluster_enabled:0

# Keyspace

------ CLIENT LIST OUTPUT ------

------ REGISTERS ------
4428:M 17 Nov 2020 21:38:11.222 #
RAX:0000000306017b80 RBX:0000000000000013
RCX:0000000306018000 RDX:00007fd6be3ed8ce
RDI:0000000306017b38 RSI:0000000000000000
RBP:0000000306017910 RSP:0000000306017728
R8 :0000000000000000 R9 :00000003060177e0
R10:0000000100f587b3 R11:ffffffffffffffff
R12:00000003060179b8 R13:00000000000000ff
R14:0000000100f59127 R15:0000000100f89740
RIP:00007fff203b9430 EFL:0000000000000202
CS :000000000000002b FS:0000000000000000  GS:0000000000000000
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017737) -> 0000000109a3ea00
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017736) -> 0000000000000006
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017735) -> 0000000000000000
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017734) -> 0000000000002800
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017733) -> 0000000000000000
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017732) -> 00007fff2019a020
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017731) -> 0000000100f67bca
4428:M 17 Nov 2020 21:38:11.222 # (0000000306017730) -> 0000000100efb4d6
4428:M 17 Nov 2020 21:38:11.222 # (000000030601772f) -> 00000003060178a0
4428:M 17 Nov 2020 21:38:11.222 # (000000030601772e) -> 00007fd9c4400000
4428:M 17 Nov 2020 21:38:11.222 # (000000030601772d) -> 0000000100f5ad38
4428:M 17 Nov 2020 21:38:11.222 # (000000030601772c) -> 00000000000018eb
4428:M 17 Nov 2020 21:38:11.222 # (000000030601772b) -> 0000000100f55bcd
4428:M 17 Nov 2020 21:38:11.222 # (000000030601772a) -> 0000000306017b38
4428:M 17 Nov 2020 21:38:11.223 # (0000000306017729) -> 00007fd9c445a3b0
4428:M 17 Nov 2020 21:38:11.223 # (0000000306017728) -> 0000000100f0bebb

------ MODULES INFO OUTPUT ------

------ DUMPING CODE AROUND EIP ------
Symbol: _platform_memset$VARIANT$Rosetta (base: 0x7fff203b93c4)
Module: /usr/lib/system/libsystem_platform.dylib (base 0x7fff203b3000)
$ xxd -r -p /tmp/dump.hex /tmp/dump.bin
$ objdump --adjust-vma=0x7fff203b93c4 -D -b binary -m i386:x86-64 /tmp/dump.bin
------
4428:M 17 Nov 2020 21:38:11.223 # dump of function (hexdump of 236 bytes):
81e6ff00000048b90101010101010101480faff14889f94883fa400f82360100004881fa008000000f82a00000000faef0480fc337480fc37708480fc37710480fc37718480fc37720480fc37728480fc37730480fc37738488d4f404883e1c04801fa488d41404829c27631480fc331480fc37108480fc37110480fc37118480fc37120480fc37128480fc37130480fc371384883c1404883ea4077cf4801d1480fc331480fc37108480fc37110480fc37118480fc37120480fc37128480fc37130480fc371380faef84889f8c3488937488977084889771048897718488977204889772848897730488977

=== REDIS BUG REPORT END. Make sure to include from START to END. ===

Aditional information

OS distribution and version: macOS Big Sur 11.0.1, MacBook Air M1 (8-core, 7-core GPU)
Steps to reproduce (if any)

  1. Installed via Rosetta-run Homebrew arch -x86_64 brew install redis.
  2. Run redis-server or arch -x86_64 redis-server as a normal user.
  3. Crash.

Runs without issue with sudo.

@oranagra
Copy link
Member

@qwertywelch thank you for submitting this report.

i'm guessing si_code of 2 means SEGV_ACCERR. can you please confirm (look for it in your /usr/include or equivalent).

the stack trace looks a bit odd, can you try to build redis with debug symbols and no optimizations (make noopt) and see if we get a better stack trace?

@nw-b
Copy link
Author

nw-b commented Nov 18, 2020

@oranagra This perhaps what you're looking for?

Process:               redis-server [4212]
Path:                  /usr/local/Cellar/redis/6.0.9/bin/redis-server
Identifier:            redis-server
Version:               ???
Code Type:             X86-64 (Translated)
Parent Process:        ??? [1]
Responsible:           redis-server [4212]
User ID:               501

Date/Time:             2020-11-17 21:35:24.481 -0500
OS Version:            macOS 11.0.1 (20B29)
Report Version:        12
Anonymous UUID:        52446E17-AB34-409E-A3F6-F73D0E0E79BF


Time Awake Since Boot: 340 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000305c26000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   redis-server [4212]

VM Regions Near 0x305c26000:
    Stack                       30542a000-305c26000    [ 8176K] rw-/rwx SM=PRV  
--> 
    commpage (reserved)         fc0000000-1000000000   [  1.0G] ---/--- SM=NUL  reserved VM address space (unallocated)

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	0x00007ffe95c6a9bc ???
1   libsystem_kernel.dylib        	0x00007fff20343fde __kill + 10
2   libsystem_platform.dylib      	0x00007fff203b6d7d _sigtramp + 29
3   libsystem_malloc.dylib        	0x00007fff2019c7aa tiny_free_no_lock + 1116
4   ???                           	000000000000000000 0 + 0
5   libsystem_c.dylib             	0x00007fff2027f729 fopen + 116
6                                 	0x0000000100c06045 createPidFile + 53
7                                 	0x0000000100c06f9d main + 1163
8   libdyld.dylib                 	0x00007fff2038d631 start + 1

Thread 1:: com.apple.rosetta.exceptionserver
0   runtime                       	0x00007ffdffe28cb8 0x7ffdffe26000 + 11448
1   runtime                       	0x00007ffdffe32ee0 0x7ffdffe26000 + 52960
2   runtime                       	0x00007ffdffe33c3c 0x7ffdffe26000 + 56380

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000000000415  rcx: 0x0000000000000000  rdx: 0x0000000000000001
  rdi: 0x0000000000000000  rsi: 0x00007fff203b93c4  rbp: 0x00007fff88aba9d8  rsp: 0x00000000000130a8
   r8: 0x0000001500000000   r9: 0x00007fff88aba9d8  r10: 0x0000000000000415  r11: 0x00007fff20343fc9
  r12: 0x00000000000000ec  r13: 0x00007fb01c809005  r14: 0x000000000000000b  r15: 0x00000001097da088
  rip: <unavailable>  rfl: 0x0000000000000283


Binary Images:
       0x100bf7000 -        0x100ccafff + (0) <29F294FA-7055-3ECB-B261-2474750DF6D1> 
       0x109186000 -        0x1091d5fff +libssl.1.1.dylib (0) <2BA6F0C6-7BAB-30E7-88CA-802EB05A2C10> /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
       0x10929c000 -        0x10945bfff +libcrypto.1.1.dylib (0) <C47A045A-5436-3B19-A48D-4A2FE13CBBF9> /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib
       0x200f17000 -        0x200fb2fff  dyld (832.7.1) <2705F0D8-C104-3DE9-BEB5-B1EF6E28656D> /usr/lib/dyld
    0x7ffdffe26000 -     0x7ffdffe99fff +runtime (203.1.3) <32F67E63-80F9-3251-A012-C2AD43E420BE> /Library/Apple/*/runtime
    0x7fff200aa000 -     0x7fff200abfff  libsystem_blocks.dylib (78) <83E2F888-F4C1-3181-B21B-136A0D7293DD> /usr/lib/system/libsystem_blocks.dylib
    0x7fff200ac000 -     0x7fff200e1fff  libxpc.dylib (2038.40.38) <DC50F7DD-1C4B-3BD2-A54D-C5D7D97A3718> /usr/lib/system/libxpc.dylib
    0x7fff200e2000 -     0x7fff200f9fff  libsystem_trace.dylib (1277.50.1) <94196441-5456-342D-84D1-C60A9249D273> /usr/lib/system/libsystem_trace.dylib
    0x7fff200fa000 -     0x7fff20195fff  libcorecrypto.dylib (1000.40.21) <2FA5C1BD-F41C-3FCF-B1FA-7BED6E19ABEE> /usr/lib/system/libcorecrypto.dylib
    0x7fff20196000 -     0x7fff201c2fff  libsystem_malloc.dylib (317.40.8) <3688DBCE-2FFD-3F98-B12B-69ABE231908D> /usr/lib/system/libsystem_malloc.dylib
    0x7fff201c3000 -     0x7fff20207fff  libdispatch.dylib (1271.40.12) <C55547DC-A05B-34A1-BD41-D54948D8F57F> /usr/lib/system/libdispatch.dylib
    0x7fff20208000 -     0x7fff20241fff  libobjc.A.dylib (818.2) <009C043E-EA6B-38AF-8ABD-C57E1B42A0EE> /usr/lib/libobjc.A.dylib
    0x7fff20242000 -     0x7fff20244fff  libsystem_featureflags.dylib (28.40.2) <3E1E8F98-E791-301D-909F-4CA205C94D1A> /usr/lib/system/libsystem_featureflags.dylib
    0x7fff20245000 -     0x7fff202cdfff  libsystem_c.dylib (1439.40.11) <8D791F3A-4848-302F-88CD-46D91DE73127> /usr/lib/system/libsystem_c.dylib
    0x7fff202ce000 -     0x7fff20323fff  libc++.1.dylib (904.4) <E7F465AC-C8FF-31DB-8EC4-7EBBA7468EB5> /usr/lib/libc++.1.dylib
    0x7fff20324000 -     0x7fff2033cfff  libc++abi.dylib (904.4) <253848B5-ED35-3202-8593-5DCC763A8192> /usr/lib/libc++abi.dylib
    0x7fff2033d000 -     0x7fff2036bfff  libsystem_kernel.dylib (7195.50.7) <41068F5C-74E3-3C98-9256-6A18364FB5BA> /usr/lib/system/libsystem_kernel.dylib
    0x7fff2036c000 -     0x7fff20377fff  libsystem_pthread.dylib (454.40.3) <78072EC6-2257-361A-AAF5-4A3C1832B5EB> /usr/lib/system/libsystem_pthread.dylib
    0x7fff20378000 -     0x7fff203b2fff  libdyld.dylib (832.7.1) <0C66AB9F-E22C-3286-B76B-DA4008698CD2> /usr/lib/system/libdyld.dylib
    0x7fff203b3000 -     0x7fff203bcfff  libsystem_platform.dylib (254.40.4) <6C05D209-129A-373A-A90D-CC27AB18C091> /usr/lib/system/libsystem_platform.dylib
    0x7fff203bd000 -     0x7fff203e8fff  libsystem_info.dylib (542.40.3) <90DDEF9D-9DBA-3599-A9DD-A7F730AE945F> /usr/lib/system/libsystem_info.dylib
    0x7fff22706000 -     0x7fff2270ffff  libsystem_darwin.dylib (1439.40.11) <3BD9046F-FAED-3FD9-8191-49A4618555A3> /usr/lib/system/libsystem_darwin.dylib
    0x7fff22b20000 -     0x7fff22b2bfff  libsystem_notify.dylib (279.40.4) <73D358B2-6C2D-33DF-975C-BE9EE5F45A0F> /usr/lib/system/libsystem_notify.dylib
    0x7fff24a75000 -     0x7fff24a83fff  libsystem_networkextension.dylib (1295.40.29) <84A5011E-1511-30C7-86D8-514CFA59EF42> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff24ae1000 -     0x7fff24af7fff  libsystem_asl.dylib (385) <EB8BA94D-1B45-322E-9D26-272872423807> /usr/lib/system/libsystem_asl.dylib
    0x7fff26207000 -     0x7fff2620efff  libsystem_symptoms.dylib (1431.40.36) <81345ED1-342F-347F-B979-39846E607C8C> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff28531000 -     0x7fff28541fff  libsystem_containermanager.dylib (318.41.1) <BF178091-2151-3462-AB4F-A2E111650BA2> /usr/lib/system/libsystem_containermanager.dylib
    0x7fff29247000 -     0x7fff2924afff  libsystem_configuration.dylib (1109.40.9) <EA408233-7EA5-33B5-B099-E9609DD3A0FF> /usr/lib/system/libsystem_configuration.dylib
    0x7fff2924b000 -     0x7fff2924ffff  libsystem_sandbox.dylib (1441.40.38) <349F71A1-4C7C-3AE0-8A1B-B95CCBB2327F> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff29e5a000 -     0x7fff29e5cfff  libquarantine.dylib (119.40.2) <3DD7F9EE-9B9A-3896-A8CC-4D5BE49385AE> /usr/lib/system/libquarantine.dylib
    0x7fff2a3dc000 -     0x7fff2a3e0fff  libsystem_coreservices.dylib (127) <670DDFEB-8100-3C51-BC96-76BD46A21DF6> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff2a5f7000 -     0x7fff2a642fff  libsystem_m.dylib (3186.40.2) <F1481BE9-A26B-3C4C-90BB-4EB46DFA1DE9> /usr/lib/system/libsystem_m.dylib
    0x7fff2a644000 -     0x7fff2a649fff  libmacho.dylib (973.4) <F2E3F7A6-B15A-30ED-A6AD-4EFEC37CF3E7> /usr/lib/system/libmacho.dylib
    0x7fff2a666000 -     0x7fff2a671fff  libcommonCrypto.dylib (60178.40.2) <66E10FDF-896D-35F4-B9A8-8EE9400AC23A> /usr/lib/system/libcommonCrypto.dylib
    0x7fff2a672000 -     0x7fff2a67cfff  libunwind.dylib (200.10) <BD13DE19-15F8-3982-ACCB-CD8C036D5D2B> /usr/lib/system/libunwind.dylib
    0x7fff2a67d000 -     0x7fff2a684fff  liboah.dylib (203.1.3) <5EC28751-3BE8-3BB7-9DBE-305225CBD41B> /usr/lib/liboah.dylib
    0x7fff2a685000 -     0x7fff2a68ffff  libcopyfile.dylib (173.40.2) <17A9CD2E-0527-3FF7-9CFA-57B30133DFB5> /usr/lib/system/libcopyfile.dylib
    0x7fff2a690000 -     0x7fff2a697fff  libcompiler_rt.dylib (102.2) <FE958653-7FEC-3ADD-9AC0-A386E47208CF> /usr/lib/system/libcompiler_rt.dylib
    0x7fff2a698000 -     0x7fff2a69afff  libsystem_collections.dylib (1439.40.11) <31C10DA5-F9B8-36E4-B859-8F6B845FF65D> /usr/lib/system/libsystem_collections.dylib
    0x7fff2a69b000 -     0x7fff2a69dfff  libsystem_secinit.dylib (87.40.10) <BB2A70F5-BECC-34BD-90FE-14D31C5FD80D> /usr/lib/system/libsystem_secinit.dylib
    0x7fff2a69e000 -     0x7fff2a6a0fff  libremovefile.dylib (49.40.3) <24CE2291-AEB3-30C9-94E8-535AA6E9C6F2> /usr/lib/system/libremovefile.dylib
    0x7fff2a6a1000 -     0x7fff2a6a1fff  libkeymgr.dylib (31) <B47F66C0-27F4-3B77-BAA0-85E895A7421D> /usr/lib/system/libkeymgr.dylib
    0x7fff2a6a2000 -     0x7fff2a6a9fff  libsystem_dnssd.dylib (1310.40.42) <F54EC6FB-DEC3-3DA8-A749-4892F50D1F08> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff2a6aa000 -     0x7fff2a6affff  libcache.dylib (83) <C83C4423-D12A-32A0-875D-81450DF40F42> /usr/lib/system/libcache.dylib
    0x7fff2a6b0000 -     0x7fff2a6b1fff  libSystem.B.dylib (1292.50.1) <14E3BB7B-B95F-3700-8D12-B9B2012C0AF8> /usr/lib/libSystem.B.dylib
    0x7fff2dc37000 -     0x7fff2dc37fff  liblaunch.dylib (2038.40.38) <D71781B5-4034-3349-BBE5-4B796CD3629A> /usr/lib/system/liblaunch.dylib
    0x7fff300d5000 -     0x7fff300d5fff  libsystem_product_info_filter.dylib (8.40.1) <FF59B842-1290-3C4A-9015-AC972563406E> /usr/lib/system/libsystem_product_info_filter.dylib

Translated Code Information:
  tmp0: 0xffffffffffffffff tmp1: 0x00007ffe95c6a990 tmp2: 0x0000000100ecc500


External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 155
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=515.0M resident=0K(0%) swapped_out_or_unallocated=515.0M(100%)
Writable regions: Total=295.6M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=295.6M(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        1 
MALLOC                            26.1M       11 
MALLOC guard page                   96K        4 
MALLOC_MEDIUM (reserved)         120.0M        1         reserved VM address space (unallocated)
Rosetta Arena                     2048K        1 
Rosetta Generic                    720K      177 
Rosetta IndirectBranch              32K        1 
Rosetta JIT                      128.0M        1 
Rosetta Return Stack                20K        2 
Rosetta Thread Context              20K        2 
Stack                             8176K        1 
Stack Guard                       56.0M        1 
VM_ALLOCATE                       8640K        4 
__DATA                             661K       49 
__DATA_CONST                       466K       36 
__DATA_DIRTY                        58K       21 
__LINKEDIT                       506.8M       11 
__OBJC_RO                         61.0M        1 
__OBJC_RW                         2466K        2 
__TEXT                            8420K       47 
mapped file                        4.1G       81 
shared memory                       32K        2 
unshared pmap                     2048K        1 
===========                     =======  ======= 
TOTAL                              5.0G      458 
TOTAL, minus reserved VM space     4.9G      458 

I'll try doing a debug build.

@oranagra
Copy link
Member

ok, this stack trace looks much better createPidFile -> fopen.
the previous one showed luaD_call -> tiny_free_no_lock
maybe running it under strace will reveal something else? please try.
i don't see how anything we do in redis can lead to fopen to cause segmentation fault.
unless the filename is garbage, but then why would it succeed with sudo?

@tf-ddanilyuk
Copy link

It does succeed with sudo

@oranagra
Copy link
Member

again, i suggest running it with strace to try to reveal more details.

i really don't see how a bug in redis can lead to segfault in fopen unless the filename is garbage, and if that was the case it would have happened with sudo too.

@yossigo
Copy link
Member

yossigo commented Nov 22, 2020

If I understand correctly, this is a x86_64 binary running on M1 arm64 after being translated so theoretically could also be an issue with the translation process. Not very optimistic about strace helping in this case, it may require someone taking a step further in debugging this on the said platform.

@oranagra
Copy link
Member

@Developer-Ecosystem-Engineering maybe you know anyone that can look into a possible problem with the translator.

@austenc
Copy link

austenc commented Nov 22, 2020

I also noticed this when trying to use Redis with homebrew on an M1 Mac. Homebrew reports that it started the server correctly, but it does not.

Running redis-server fails, but running sudo redis-server works. This is running x86_64 binary after being translated.

For folks who might be finding this thread, a "workaround" in the meantime is to start the Redis server like this manually:

sudo redis-server --daemonize yes

@Developer-Ecosystem-Engineering
Copy link
Contributor

@Developer-Ecosystem-Engineering maybe you know anyone that can look into a possible problem with the translator.

Taking a look, might be a while given the time of year.

@Developer-Ecosystem-Engineering
Copy link
Contributor

Not reproducing this, working fine either way sudo or without. I see at least two people reporting it. Was this a MacBook Pro? Mac mini? A Feedback to Apple is the ideal way to kick off an investigation, as this is the Redis issue tracker.

@austenc
Copy link

austenc commented Dec 2, 2020

For me, it was happening on an 13" M1 MacBook pro.

@williammck
Copy link

Same here - 13" M1 MBP. I'm seeing it fail as both root and user through brew services (i.e. launchd), and just as user when running redis-server in CLI.
I tried to see if I could get dtruss to do anything, but it apparently can't instrument processes running in Rosetta.

@mapringg
Copy link

mapringg commented Dec 3, 2020

I tried yesterday via arm version of homebrew and restarting the service works. However, I have the same problem two days ago.

@Developer-Ecosystem-Engineering
Copy link
Contributor

It has been reproduced, don't think it is related to our original PR at the moment but still working on it thanks.

@Developer-Ecosystem-Engineering
Copy link
Contributor

This appears to be a long standing bug in Redis. It can reproduce on Intel or Apple silicon based Macs and is unrelated to our prior contribution.

When redis-server starts up, it takes note of where argv[0] is located and how far it, the other args, and env vars extend [1]. Later it overwrites that to customize what's shown in tools like ps [2]. There's an assumption in the implementation that argv[0], the other args, and env vars are all stored contiguously, one string after the other. So, it walks over each arg and env var keeping track of last address for all the strings.

The trouble comes when one adds a new env var before the initialization start / end of args and env vars takes place. The new env var can be allocated in some other region, which breaks the assumption about all of them being together. If the new env var is allocated in a lower memory address, no problem its ignored. On the other hand, if the new env var is allocated in a higher memory address, it updates the notion of the end of the buffer. Later, when Redis goes to memset / bzero the buffer, the length calculation is way too large and written off the end of thread 0's stack.

As for why sudo works around the issue, it changes the env variables! Why is it showing up now more often on Apple silicon? The stack for thread 0 on Apple silicon has a lot of open address space above.

There was a similar issue diagnosed #8088 a few days ago

[1]

void spt_init(int argc, char *argv[]) {

[2]
void setproctitle(const char *fmt, ...) {

@oranagra
Copy link
Member

oranagra commented Dec 5, 2020

@Developer-Ecosystem-Engineering thank you for this detailed analysis.
@yossigo can you please handle this one.

@oranagra oranagra added this to To Do in 6.0 Backport via automation Dec 5, 2020
@oranagra oranagra added this to To do in 6.2 via automation Dec 5, 2020
@yossigo
Copy link
Member

yossigo commented Dec 7, 2020

Pushed a possible fix in #8150 but can someone who is able to reproduce this problem confirm that it is indeed solved? Thanks!

@tayhalla
Copy link

tayhalla commented Dec 8, 2020

@yossigo found this thread after I ran into this an hour ago w the new m1 macbook. Pulled your commit down, built all locally, and it's looking good over here. Nice work!

@oranagra oranagra moved this from To do to In progress in 6.2 Dec 8, 2020
@erf
Copy link

erf commented Dec 8, 2020

@yossigo I was also able to build it using your fix on an m1 macbook using rosetta and run it as a non root.

I noticed some failing tests though (but that is probably not related) and i was not able to build it without rosetta. Are there any plans on supporting m1 builds?

@yossigo
Copy link
Member

yossigo commented Dec 8, 2020

Thanks @erf, Can you post more info about the build failures and failed tests please?

@oranagra oranagra mentioned this issue Dec 16, 2020
@anamba
Copy link

anamba commented Dec 22, 2020

As for why sudo works around the issue, it changes the env variables!

Aha! That helped me find this simple workaround:

env -i /usr/local/bin/redis-server --daemonize yes

(Yep, I just got a new M1 mac.)

@rahim
Copy link

rahim commented Jan 19, 2021

Thank you @anamba, super helpful.

I hit this issue from the context of my brew service managed launchagent failing to start redis on boot (ie brew services start redis@4.0). For anyone in the same boat, I successfully applied the suggested env var isolation by editing the plist as follows

$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

(I'm using the @4.0 formula here, but the default redis version should work similarly)

Update ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>KeepAlive</key>
    <dict>
      <key>SuccessfulExit</key>
      <false/>
    </dict>
    <key>Label</key>
    <string>homebrew.mxcl.redis@4.0</string>
    <key>ProgramArguments</key>
    <array>
+     <string>env -i</string>
      <string>/usr/local/opt/redis@4.0/bin/redis-server</string>
      <string>/usr/local/etc/redis.conf</string>
      <string>--daemonize no</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/usr/local/var</string>
    <key>StandardErrorPath</key>
    <string>/usr/local/var/log/redis.log</string>
    <key>StandardOutPath</key>
    <string>/usr/local/var/log/redis.log</string>
  </dict>
</plist>
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

I contemplated opening a PR in brew for this, but hopefully this is a temporary bandaid until redis fix their bug.

@oranagra
Copy link
Member

oranagra commented Jan 19, 2021

FYI, this bug is fixed in Redis 5.0.11, 6.0.10 and 6.2 RC2

@diabolo
Copy link

diabolo commented Mar 5, 2021

@rahim: Your plist fix is super helpful. I think you should contribute it to brew :)

@Pyrolistical
Copy link

I couldn't get @rahim's solution to work with redis@3.2 by editing /usr/local/Cellar/redis@3.2/3.2.13_1/homebrew.mxcl.redis@3.2.plist

But @anamba's solution of directly running it worked

@xf329
Copy link

xf329 commented Sep 13, 2023

same solution works fine.

before:
brew services start redis@4.0 —— status error
/usr/local/opt/redis@4.0/bin/redis-server /usr/local/etc/redis.conf --daemonize no —— works fine

after:
I change /usr/local/Cellar/redis@4.0/4.0.14_1/homebrew.mxcl.redis@4.0.plist to this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>homebrew.mxcl.redis@4.0</string>
	<key>LimitLoadToSessionType</key>
	<array>
		<string>Aqua</string>
		<string>Background</string>
		<string>LoginWindow</string>
		<string>StandardIO</string>
		<string>System</string>
	</array>
	<key>ProgramArguments</key>
	<array>
		<string>arch</string>
		<string>-x86_64</string>
		<string>/usr/local/opt/redis@4.0/bin/redis-server</string>
		<string>/usr/local/etc/redis.conf</string>
		<string>--daemonize</string>
		<string>no</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/usr/local/var/log/redis.log</string>
	<key>StandardOutPath</key>
	<string>/usr/local/var/log/redis.log</string>
	<key>WorkingDirectory</key>
	<string>/usr/local/var</string>
</dict>
</plist>
$ brew services list
Name      Status  User    File
redis@4.0 started xxx ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

Thank you @anamba, super helpful.

I hit this issue from the context of my brew service managed launchagent failing to start redis on boot (ie brew services start redis@4.0). For anyone in the same boat, I successfully applied the suggested env var isolation by editing the plist as follows

$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

(I'm using the @4.0 formula here, but the default redis version should work similarly)

Update ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>KeepAlive</key>
    <dict>
      <key>SuccessfulExit</key>
      <false/>
    </dict>
    <key>Label</key>
    <string>homebrew.mxcl.redis@4.0</string>
    <key>ProgramArguments</key>
    <array>
+     <string>env -i</string>
      <string>/usr/local/opt/redis@4.0/bin/redis-server</string>
      <string>/usr/local/etc/redis.conf</string>
      <string>--daemonize no</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/usr/local/var</string>
    <key>StandardErrorPath</key>
    <string>/usr/local/var/log/redis.log</string>
    <key>StandardOutPath</key>
    <string>/usr/local/var/log/redis.log</string>
  </dict>
</plist>
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis@4.0.plist

I contemplated opening a PR in brew for this, but hopefully this is a temporary bandaid until redis fix their bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.