lua-websockets icon indicating copy to clipboard operation
lua-websockets copied to clipboard

attempt to yield across C-call boundary

Open duzc2 opened this issue 9 years ago • 5 comments

local copas = require'copas' local ws_client = require('websocket.client').copas() ws_client:connect('ws://127.0.0.1:8180/')

error:copas.lua:298: attempt to yield across C-call boundary

env: luajit 2.0.2 the last version of copas and coxpcall windows 7

duzc2 avatar Apr 28 '15 10:04 duzc2

can you provide more info? within my test environment, this works: https://github.com/lipp/lua-websockets/blob/master/spec/server_copas_spec.lua#L109

lipp avatar May 03 '15 09:05 lipp

I can confirm I'm getting the same problem as the OP. Here's the stacktrace I get:

G:\OSS\cryptofu>luajit
LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/
JIT: ON SSE2 SSE3 fold cse dce fwd dse narrow loop abc sink fuse
> copas = require 'copas'
> ws_client = require 'websocket.client'.copas()
> =ws_client
table: 0x00328998
> =ws_client:connect "ws://echo.websocket.org"
G:/LuaRocks/systree/share/lua/5.1/copas.lua:350: attempt to yield across C-call
boundary
stack traceback:
        [C]: in function 'yield'
        G:/LuaRocks/systree/share/lua/5.1/copas.lua:350: in function 'connect'
        ...uaRocks/systree/share/lua/5.1/websocket\client_copas.lua:16: in function 'sock_connect'
        G:/LuaRocks/systree/share/lua/5.1/websocket\sync.lua:128: in function <G:/LuaRocks/systree/share/lua/5.1/websocket\sync.lua:120>
        [C]: at 0x004021a0
>

env: luajit 2.1.0 copas 2.0.0-1 luasec 0.6-1 luasocket 3.0rc1 Windows 7 64-bit

Let me know if there's any other piece of info you need to help track down this bug.

greatwolf avatar Dec 10 '16 06:12 greatwolf

Just tested this on lua 5.1.5 and getting similar stacktrace:

G:\OSS\cryptofu>G:\Lua-5.1.5\lua.exe
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> copas = require 'copas'
> ws = require'websocket.client'.copas()
> =ws
table: 00475FC0
> =ws.connect
function: 00475D90
> =ws:connect "ws://echo.websocket.org"
attempt to yield across metamethod/C-call boundary
stack traceback:
        [C]: in function 'yield'
        G:/LuaRocks/systree/share/lua/5.1/copas.lua:350: in function 'connect'
        ...cks/systree/share/lua/5.1/websocket\client_copas.lua:16: in function
'sock_connect'
        G:/LuaRocks/systree/share/lua/5.1/websocket\sync.lua:128: in function <G
:/LuaRocks/systree/share/lua/5.1/websocket\sync.lua:120>
        (tail call): ?
        [C]: ?
>

environment and settings the same as above except PUC-Lua 5.1.5 is used instead of luajit.

greatwolf avatar Dec 10 '16 06:12 greatwolf

Hi,

I also get this error on LEDE: lua -v Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio (double int32)

First prise will be if there are a fix for the COPAS, else I'll try and get someone to build me the lua-ev package to try that since I'll need a mainloop in my application.

If you need more info feel free to ask and I'll gladly provide it

dirkvanderwalt avatar Feb 06 '17 13:02 dirkvanderwalt

It should be mentioned in the documentation that copas-mode code must run inside copas.addthread

jsopenrb avatar Mar 23 '18 11:03 jsopenrb