Scope

Goal is to provide a reference crash upload solution to RDK-B community


Architecture

  • crashuploadrdkb


How to setup a simple file server in local Host machine(MacBook)

  • python3 -m uploadserver 8080 &

  •  dmcli eRT getv Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.CrashPortal
    CR component name is: eRT.com.cisco.spvtg.ccsp.CR
    subsystem_prefix eRT.
    Execution succeed.
    Parameter    1 name: Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.CrashPortal
                   type:     string,    value: http://10.2.156.149:8080/upload 
    
    
    

CPE configurations

  • ulimit -c unlimited

code repo

Build side

  • inherit breakpad-wrapper  ------- to generate symbols in the build
  • ~/kernel66$ ls build-bananapi4-rdk-broadband/tmp/deploy/breakpad_symbols/
    bananapi4-rdk-broadband
    cpokur625@dvm-yocto4-docker-cpokur625:~/kernel66$ ls build-bananapi4-rdk-broadband/tmp/deploy/breakpad_symbols/bananapi4-rdk-broadband/

Appendix

Process to upload dumps to server in RDK-B Component

    • Integrate breakpad for the RDK-B component if it is not already integrated.
    • Add crashupload package to the respective .bbappend file
    • Make necessary changes in uploadDumps.sh and add it as a patch in crashupload_git.bbappend
    • Install the uploadDumps.sh and its dependencies in respective crashupload.bbappend file
    • Add requirements and dependencies to coredump-upload.service and coredump-upload.path in the crashupload_git.bbappend file.
    • After building the component, flash the image in RPI4 and check whether coredump-upload.path and coredump-upload.service files were added in systemd or not.
    • Check both the files are in active state or not.
    • Generate a crash on the component and it will create .dmp file in /minidumps/ folder and coredump-upload.path triggers coredump-upload.service to upload the dump files to crash portal.
    • Below logs will be generated during the execution of uploadDumps and same can be seen in /rdklogs/logs/core_log.txt
         
    • Check from server side the upload was successful or not.
    • Attached procedure for installing breakpad and generating crash in local machine.


    Test Procedure followed in BPIR4 for crashupload feature 

  • Existing curl command in the uploadDumps.sh script is having so many argument options for uploading the files to the server. 
  • For uploading files to our local apache server from BPIR4, Added below change in the build to upload the core dump files to local apache server.
    git diff uploadDumps.sh
    @@ -1171,6 +1171,8 @@ uploadToS3()
             if [ "$IS_T2_ENABLED" == "true" ]; then
                 t2CountNotify "SYS_INFO_S3CoreUploaded"
             fi
    +       cp $updatedfile /tmp/
    +       curl -X POST -F "file=@/tmp/$updatedfile" "$S3_AMAZON_SIGNING_URL"
             #Removing updated timestamp minidump/coredump file since processDumps func will remove old timestamp minidump/coredump file.
             logMessage "Removing uploaded $DUMP_NAME file $updatedfile"
             rm -rf $updatedfile
  • Performed set operation on below DM to update the server URL. In our case, local apache server URL is "http://192.168.1.11/upload.cgi"
    dmcli eRT setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.CrashUpload.S3SigningUrl string http://192.168.1.11/upload.cgi

  • Added a cgi script file in the local apache server to handle the files uploading to the server.

    #!"C:\strawberry-perl-5.38.2.2-64bit-portable\perl\bin\perl.exe"
    
    use strict;
    use CGI;
    
    # Create a new CGI object
    my $cgi = CGI->new;
    
    # Get the uploaded file handle
    my $filehandle = $cgi->upload('file');
    
    # Check if a file was uploaded
    if ($filehandle) {
        # Set the upload directory
        my $upload_dir = 'C:/Apache24/htdocs/tar_upload/';
    
        # Get the original filename
        my $filename = $cgi->param('file');
    
        # Generate a unique filename to prevent overwriting existing files
        my $unique_filename = sprintf("%s", $filename);
    
        # Set the full path to the uploaded file
        my $upload_file = $upload_dir . $unique_filename;
    
        # Open a new file handle for writing
        open(my $fh, '>', $upload_file) or die "Cannot open file: $!";
    	
    	binmode $fh;
    
        # Write the uploaded file data to the new file
        while (my $chunk = $filehandle->getline()) {
            print $fh $chunk;
        }
    
        # Close the file handle
        close($fh);
    
        # Print a success message
        print $cgi->header(-type=>'text/plain');
        print "File uploaded successfully as: $unique_filename";
    } else {
        # Print an error message if no file was uploaded
        print $cgi->header(-type=>'text/plain', -status=>'400 Bad Request');
        print "No file uploaded";
    }


  • After getting the tar file, generate backtrace from the dump file. Please refer the procedure mentioned above to generate backtrace from the uploaded dump file.


  • No labels