openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
155 stars 131 forks source link

Bug about redfish return long time #285

Closed lingyaof closed 3 weeks ago

lingyaof commented 1 month ago

Is this the right place to submit this?

Bug Description

hi all
if i have two url , URL1 will return in 15s , URL2 will return in 500ms Send URL1 first and then send URL2, I found that URL2 blocks and waits for URL1 to return before returning

Version

my bmcweb package version 
e01d0c36af115ed46d54b5dbbacfe3ad92226bd3

Additional Information

No response

edtanous commented 1 month ago

Please provide examples of url1 and url2 so this can be reproduced.

lingyaof commented 1 month ago

ok thanks my URL1 (get my all sensor data): connect dbus getsubtreepaths and getallproperty,so It will run for a long time and have a large data my URL2 (is my test url): only connect dbus get one property

they all use asio::func to connect dbus about (async_method_call)

edtanous commented 1 month ago

What are the exact urls? In the form of /redfish/v1/Chassis

If we can’t reproduce, there’s nothing we can do to help.

lingyaof commented 1 month ago

i add bmclog in bmcweb , i found that in dbus_privileges.hpp [func validatePrivilege] , connect dbus and GetUserInfo , my URL2 seems to be block here and URL1 URL2 asyncResp was released almost at the same time

lingyaof commented 1 month ago

YES is form of /redfish/v1/Chassis redfish/v1/Chassis/1/Sensors?$expand=.

edtanous commented 1 month ago

How do you reproduce the issue using that url? Please include exact steps and tools.

lingyaof commented 1 month ago

At first, my webui home page loads a bit slowly ,because redfish needed to solve many url request at the same time , then i think whether bmcweb not have the ability to process requests simultaneously (or async requests), but I added bmclog and found that webserver crow is capable of receiving requests asynchronously, although there may be a blocking situation when processing requests.

So i write two URL to test , URL1 will return in 15s , URL2 will return in 500ms when i first send URL1 and then send URL2 , URL2 will return more than 15s

lingyaof commented 1 month ago

here is my shell

#!/bin/bash

request_and_measure_time() {
    local url=$1
    local output=$(curl --write-out "Total time: %{time_total}\n" --silent -k -S -u root:Admin "${url}")
    local total_time=$(echo $output | awk -F'[: ]' '{print $(NF)}')

    if (( $(echo "$total_time > 0.6" | bc -l) )); then
        echo "${url}, time was: ${total_time} seconds."
    else
        echo "Request < 0.6s for ${url}, time was: ${total_time} seconds."
    fi
}

BMC_IP="10.10.10.10"

request_and_measure_time "https://$BMC_IP/redfish/v1/Chassis/1/Sensors?\$expand=." &
request_and_measure_time "https://$BMC_IP/redfish/v1/Chassis/1" & 
edtanous commented 1 month ago

Considering that /redfish/v1/Chassis/1/Sensors

Isn't a uri bmcweb would return (ChassisCollection isn’t indexed by numbers), I’m assuming you’re either not using bmcweb, or using a fork in this test?

my bmcweb package version

https://github.com/openbmc/bmcweb/commit/e01d0c36af115ed46d54b5dbbacfe3ad92226bd3

You're running off a build a year ago. Please provide tests results from master. That still doesn't explain the discrepancy in URI above.

lingyaof commented 1 month ago

Ok i will pull it to master

lingyaof commented 1 month ago

I have another question. Could you help me answer this. Why do we recommend using [async_method_call] access to dbus not use [new_method_call]

edtanous commented 1 month ago

This isn’t the right forum for questions. The mailing list or discord are where you should ask questions. If you used new_method_call, that would explain why you’re seeing problems.

edtanous commented 4 weeks ago

Have you retested? Have you verified you’re not running on a fork?

lingyaof commented 3 weeks ago

I think that my bmcweb have used [async_method_call] and also used [new_method_call] is my fault