Skip to content

use bcos_sdk_create to create and start sdk costing 100% cpu with empty run #221

Open
@Keyon11

Description

@Keyon11

Describe the bug
I modify hello_sample.c with following code found that program always costing 100% cpu when sleep waiting for free sdk.

    // 1. create sdk object by config
    void* sdk;
    if (strlen(config) == 0) {
        struct bcos_sdk_c_config* cfg = bcos_sdk_create_config(1, "172.25.0.3", 20210);
        sdk = bcos_sdk_create(cfg);
    } else {
        sdk = bcos_sdk_create_by_config_file(config);
    }
   ... 
  sleep(300);
 //before bcos_sdk_c_free

To Reproduce
Steps to reproduce the behavior:

  1. check out branch main
  2. modify hello_sample.c as above and fix host:port
  3. compile and run hello_sample
  4. use command 'top' to see hello_sample cpu cost

Expected behavior
no empty run cost

Screenshots
none

Environment (please complete the following information):

  • OS: [e.g. CentOS 7.9]
  • fisco-bcos Version [3.2.1]

Additional context
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions