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

Bugfix core-data "get event by deviceId" api return no data #376

Closed
wants to merge 7 commits into from
Closed

Conversation

unanao
Copy link

@unanao unanao commented Jul 9, 2018

API: http://localhost:48080/api/v1/event/device/:deviceId/:limit
Error: no data returned:
Reason: As mongoEvent not match mongodb's structure(models.Event)

…o data

As mongoEvent not match mongodb's structure(models.Event)
@jduranf
Copy link
Contributor

jduranf commented Jul 9, 2018

@unanao, the events are stored as mongoEvent. Why this patch should solve the issue?

@tsconn23
Copy link
Member

tsconn23 commented Jul 9, 2018

Commit isn't signed. No issue created for this PR. Testing this PR against master for the following URL literally produces no difference in behavior.

http://localhost:48080/api/v1/event/device/KMC.BAC-121036CE01/5

Testing methodology included make run followed by running device-virtual service.

@JPWKU
Copy link
Contributor

JPWKU commented Jul 9, 2018

recheck

@JPWKU JPWKU added the hold Intended for PRs we want to flag for ongoing review label Jul 9, 2018
tonyespy and others added 4 commits July 10, 2018 12:41
Use 'govendor init' instead of 'govendor sync'.

Signed-off-by: Tony Espy <espy@canonical.com>
I observed 200% CPU utilization by core-command and core-data processes.
Profiler showed that culprit is time.Now().After() buzy-loop in
Endpoint.Monitor.
It truly spins for 15 seconds after each "ch" consumption.
Depending on consumption rate it might spin "infinitely"

$ go tool pprof core-command core-command.prof
File: core-command
Type: cpu
Time: Jul 10, 2018 at 3:24pm (PDT)
Duration: 14.52s, Total samples = 28.48s (196.11%)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top10 -cum
Showing nodes accounting for 28430ms, 99.82% of 28480ms total
Dropped 51 nodes (cum <= 142.40ms)
   flat  flat%   sum%        cum   cum%
      0     0%     0%    21840ms 76.69%  runtime._System /usr/lib/golang/src/runtime/proc.go
20430ms 71.73% 71.73%    20430ms 71.73%  runtime._ExternalCode /usr/lib/golang/src/runtime/proc.go
      0     0% 71.73%     6600ms 23.17%  github.com/edgexfoundry/edgex-go/core/clients/types.(*Endpoint).Monitor <autogenerated>
 1230ms  4.32% 76.05%     6600ms 23.17%  github.com/edgexfoundry/edgex-go/core/clients/types.Endpoint.Monitor /usr/share/gocode/src/github.com/edgexfoundry/edgex-go/core/clients/types/endpoint.go
 1440ms  5.06% 81.11%     4850ms 17.03%  time.Now /usr/lib/golang/src/time/time.go
 2030ms  7.13% 88.24%     3410ms 11.97%  time.now /usr/lib/golang/src/runtime/timestub.go
 1890ms  6.64% 94.87%     1890ms  6.64%  runtime.walltime /usr/lib/golang/src/runtime/sys_linux_amd64.s
  900ms  3.16% 98.03%      900ms  3.16%  runtime.nanotime /usr/lib/golang/src/runtime/sys_linux_amd64.s
  510ms  1.79% 99.82%      510ms  1.79%  time.Time.After /usr/lib/golang/src/time/time.go

Using time.Sleep() fixed the problem and CPU utilization back to normal.

Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Use sleep instead of busy-wait
@JPWKU
Copy link
Contributor

JPWKU commented Jul 11, 2018

recheck

@unanao
Copy link
Author

unanao commented Jul 12, 2018

I pulled the latest code, the bug not exist

@unanao unanao closed this Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold Intended for PRs we want to flag for ongoing review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants