twitter-archive / torch-ipc

A set of primitives for parallel computation in Torch
Apache License 2.0
95 stars 28 forks source link

Better closure error message #36

Closed nicholas-leonard closed 7 years ago

nicholas-leonard commented 7 years ago

This PR makes it easier to debug those pesky upvalue serialization cases. When serializing a closure, the following error message would be printed:

Attempt to serialize closure 'test/test_map.lua:81' with 2 upvalues; first is: 'i'.
Consider using ipc.workqueue.writeup() instead. 

where test/test_map.lua:81 points to the function with upvalues.

Also fixes a bug identified by @pavanky where a single upvalue (excluding _ENV) would not generate an error message.