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

attempt to yield across C-call boundary #74

Open
duzc2 opened this issue Apr 28, 2015 · 5 comments
Open

attempt to yield across C-call boundary #74

duzc2 opened this issue Apr 28, 2015 · 5 comments

Comments

@duzc2
Copy link

duzc2 commented Apr 28, 2015

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

@lipp
Copy link
Owner

lipp commented May 3, 2015

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

@greatwolf
Copy link

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
Copy link

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.

@dirkvanderwalt
Copy link

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

@jsopenrb
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants