perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

trace_processor_shell crash with debug build

Open auselen opened this issue 1 year ago • 5 comments

As current tip of the main branch (1fee17ae6961fa61), I'm trying to build and use trace_processor_shell but getting a crash after connecting from web ui and selecting "Yes, use loaded trace".

Trace config

duration_ms: 2000

buffers {
  size_kb: 16384
  fill_policy: RING_BUFFER
}

data_sources: {
    config {
        name: "android.log"
        android_log_config {
            min_prio: PRIO_WARN
        }
    }
}

Build config:

...
is_debug = true

Running trace_processor_shell: out/linux/trace_processor_shell --httpd --http-port 9001 android_log.perfetto-trace

Connecting to relevant port from web UI, selecting "Yes, use loaded trace".

[922.592] android_tables_py.h:335 PERFETTO_CHECK(!table_->dataframe_.finalized()) (errno: 11, Resource temporarily unavailable)                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                       
-----END PERFETTO PRE-CRASH LOG-----                                                                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                                                                       
Program received signal SIGILL, Illegal instruction.                                                                                                                                                                                                                                                                                                   
0x000055555601bfb6 in perfetto::trace_processor::tables::AndroidLogTable::ConstIterator::ts (this=0x7fffffff8b08)                                                                                                                                                                                                                                      
    at gen/src/trace_processor/tables/android_tables_py.h:335                                                                                                                                                                                                                                                                                          
335           PERFETTO_DCHECK(!table_->dataframe_.finalized());                                                                                                                                                                                                                                                                                        
(gdb) bt                                                                                                                                                                                                                                                                                                                                               
#0  0x000055555601bfb6 in perfetto::trace_processor::tables::AndroidLogTable::ConstIterator::ts (this=0x7fffffff8b08)                                                                                                                                                                                                                                  
    at gen/src/trace_processor/tables/android_tables_py.h:335                                                                                                                                                                                                                                                                                          
#1  0x0000555555ffe7ce in perfetto::trace_processor::(anonymous namespace)::GetTraceTimestampBoundsNs (storage=...)                                                                                                                                                                                                                                    
    at ../../src/trace_processor/trace_processor_impl.cc:444                                                                                                                                                                                                                                                                                           
#2  0x0000555555ffdbf7 in perfetto::trace_processor::TraceProcessorImpl::InitPerfettoSqlEngine (context=0x555557217ca8, storage=0x55555721d590, config=...,                                                                                                                                                                                            
    dataframe_shared_storage=0x555557218018, packages=..., sql_metrics=..., metrics_descriptor_pool=0x5555572180d8, proto_fn_name_to_path=0x555557218188,                                                                                                                                                                                              
    trace_processor=0x555557217c90, notify_eof_called=true) at ../../src/trace_processor/trace_processor_impl.cc:1448                                                                                                                                                                                                                                  
#3  0x0000555556000976 in perfetto::trace_processor::TraceProcessorImpl::RestoreInitialTables (this=0x555557217c90)                                                                                                                                                                                                                                    
    at ../../src/trace_processor/trace_processor_impl.cc:892                                                                                                                                                                                                                                                                                           
#4  0x00005555560e788a in perfetto::trace_processor::Rpc::ParseRpcRequest (this=0x7fffffffd878, data=0x7fffeb6bd008 "\b", len=4)                                                                                                                                                                                                                       
    at ../../src/trace_processor/rpc/rpc.cc:313                                                                                                                                                        

Relevant part in generated code (gen/src/trace_processor/tables/android_tables_py.h:335)

class AndroidLogTable {
  class ConstIterator {
...
        int64_t ts() const {Release
      PERFETTO_DCHECK(!table_->dataframe_.finalized());
      return table_->dataframe_.template GetCellUnchecked<ColumnIndex::ts>(kSpec, row_);
    }

I tried to follow the run, iiuc when trace processor starts it finalizes log table but then when websocket connects, it wants to reinit but this table is already finalized and program asserts.

Non-debug version worked for the same trace, but I've some big traces which crashes with trace_processor_shell but I can't debug it without hitting this issue.

auselen avatar Oct 23 '25 08:10 auselen

Thanks for filing the bug! I can't repro it though - we have a couple of test traces with android logs and they are parsing properly. Can you maybe provide the trace?

aMayzner avatar Oct 23 '25 13:10 aMayzner

Have you checked finalization state before attempting iteration? or I think Cache timestamp bounds before finalization and reuse them. The restore operation shouldn't need to re-scan tables that were already fully processed

Sagar-Singh-Airee avatar Oct 23 '25 14:10 Sagar-Singh-Airee

I'm working on a fix for this issue.

LalitMaganti avatar Oct 23 '25 15:10 LalitMaganti

Will be fixed by https://github.com/google/perfetto/pull/3382

LalitMaganti avatar Oct 23 '25 15:10 LalitMaganti

Works now, thanks.

auselen avatar Oct 23 '25 18:10 auselen