"Linos" <[email protected]> wrote:

  https://sourceforge.net/p/curl/bugs/1238/


You are welcome, thank you for create the bug report.

I also see this. Here is the stack of the main thread:

ntkrnlpa.exe!KiUnexpectedInterrupt+0x121
ntkrnlpa.exe!ZwYieldExecution+0x1c90
hal.dll!HalClearSoftwareInterrupt+0x342
python27.dll!PyEval_EvalFrameEx+0xd9f
python27.dll!PyEval_EvalCodeEx+0x6b5
python27.dll!PyEval_EvalCodeEx+0x695
python27.dll!PyFunction_SetClosure+0x86a
python27.dll!PyObject_Call+0x4c
python27.dll!PyEval_CallObjectWithKeywords+0x89
pycurl.pyd+0x284c
libcurl.dll!Curl_pgrsUpdate+0x2e4 <<< !!! this is causing python to suck 25% CPU libcurl.dll!multi_runsingle+0xc6d
libcurl.dll!curl_multi_perform+0x7c
libcurl.dll!curl_easy_perform+0xd1
pycurl.pyd+0x2279
python27.dll!PyEval_GetGlobals+0x68b

--------

I would expect a Python-script to run longer because of the limit on recv-rate. But not that it should longer because the CPU gets overloaded
by Curl_pgrsUpdate().

BTW. I used the attached script to play with. In some cases with a rate_limit of approx. 1000 bytes/sec, I also got a
   pycurl.error: (56, 'Recv failure: Connection was reset')

 Presumably because the server lost patience with such a slow client...

Win-XP SP3, pycurl + libcurl using MSVC v16.

--gv
#! /usr/bin/env python

import sys, pycurl

num_progress_callbacks = 0
dl_last = 0

def curl_progress (dl_total, dl_now, ul_total, ul_now):
  global num_progress_callbacks, dl_last

  if dl_now > 0.0 and dl_now > dl_last:
     # print ('curl_progress. dl_now %15.0f bytes' % dl_now)
     dl_last = dl_now
  num_progress_callbacks += 1
  return 0

def dev_null (buf):
  pass

def test (url, rate_limit = 0):
  if rate_limit > 0:
    print ('rate_limit %d bytes/sec' % rate_limit)
  else:
    print ('No speed limit')

  curl = pycurl.Curl()
  curl.setopt (curl.URL, url)
  curl.setopt (curl.MAX_RECV_SPEED_LARGE, rate_limit)

  curl.setopt (curl.WRITEFUNCTION, dev_null)
  curl.setopt (curl.NOPROGRESS, 0)
  curl.setopt (curl.PROGRESSFUNCTION, curl_progress)
  curl.setopt (curl.FOLLOWLOCATION, 1)

  curl.perform()
  curl.close()

rate_limit = 0
if len(sys.argv) > 1:
  rate_limit = int(sys.argv[1])

test ('http://www.vg.no', rate_limit)
print ('num_progress_callbacks %d' % num_progress_callbacks)
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to