Hi Thierry,

Found another issue, I noticed when sending mails there were spikes of high cpu usage..

Below function reproduces this. between 'task start' and 'task end' 1 cpu core is at 100%. I used a IP of some google.com webserver when testing but i guess any webserver or mailserver that keeps the connection open and doesn't send the expected newline will do.

Thousands of wakeup events happen with kqueue (there is nothing triggering it though.. the timeout is set to 0 and returns directly.).:
kevent(3,0x0,0,{ },200,{ 1.000000000 })         = 0 (0x0)
kevent(3,0x0,0,{ },200,{ 1.000000000 })         = 0 (0x0)
kevent(3,0x0,0,{ },200,{ 1.000000000 })         = 0 (0x0)

Though the same effect is seen with poll:
poll({ 3/POLLIN 4/POLLIN 6/POLLIN },3,0)     = 0 (0x0)
poll({ 3/POLLIN 4/POLLIN 6/POLLIN },3,0)     = 0 (0x0)
poll({ 3/POLLIN 4/POLLIN 6/POLLIN },3,0)     = 0 (0x0)

It seems like "TICK_ETERNITY" schedules the task to immediately execute again.?. While it sounds like it should do the opposite.. But initially the commit messages seems the !=eternity check when setting expired is being done to avoid hanging tasks.. Perhaps some middle ground is possible?

Regards,

PiBa-NL (Pieter)

mytask = function()
    core.sleep(10)
    core.Info("TASK start")
    local mailconnection = core.tcp()
    mailconnection:settimeout(60)
    mailconnection = mailconnection
    ret = mailconnection:connect("127.0.0.1","80")
    repeat
        receive = mailconnection:receive("*l")
        if receive == nil then
            break
        end
        core.Info("TASK reply:"..receive)
    until false
    core.Info("TASK end")
end
core.register_task(mytask)


Reply via email to