# Buggy code
def _submit_operand_to_execute(self):
    self._semaphore.acquire()
    self._queue.wait()

    if self._has_error.is_set():
        # error happens, ignore
        return

    to_submit_op = self._queue.pop(0)
    assert to_submit_op.key not in self._submitted_op_keys
    self._submitted_op_keys.add(to_submit_op.key)

    if self._print_progress:
        i, n = len(self._submitted_op_keys), len(self._op_key_to_ops)
        if i % 30 or i >= n:
            logger.info(
                "[{0}] {1:.2f}% percent of graph has been submitted".format(
                    str(datetime.datetime.now()), float(i) * 100 / n
                )
            )

    if self._prefetch:
        # check the operand's outputs if any of its successor's predecessors can be prefetched
        self._prefetch_executor.submit(self._fetch_chunks, to_submit_op.outputs)
    # execute the operand and return future
    return self._operand_executor.submit(self._execute_operand, to_submit_op)


# Traceback (ValueError)
In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()

~/Workspace/mars/mars/dataframe/initializer.py in __init__(self, data, index, columns, dtype, copy, chunk_size, gpu, sparse)
46             df = dataframe_from_1d_tensors(
47                 tensors, index=index, columns=columns,
---> 48                 gpu=gpu, sparse=sparse)
49         else:
50             pdf = pd.DataFrame(data, index=index, columns=columns, dtype=dtype, copy=copy)

~/Workspace/mars/mars/dataframe/datasource/from_tensor.py in dataframe_from_1d_tensors(tensors, index, columns, gpu, sparse)
328     op = DataFrameFromTensor(dtypes=dtypes, from_1d_tensors=True,
329                              gpu=gpu, sparse=sparse)
--> 330     return op(tensors, index, columns)
331
332

~/Workspace/mars/mars/dataframe/datasource/from_tensor.py in __call__(self, input_tensor, index, columns)
73     def __call__(self, input_tensor, index, columns):
74         if self._from_1d_tensors:
---> 75             return self._call_input_1d_tensors(input_tensor, index, columns)
76         else:
77             return self._call_input_tensor(input_tensor, index, columns)

~/Workspace/mars/mars/dataframe/datasource/from_tensor.py in _call_input_1d_tensors(self, input_1d_tensors, index, columns)
99     def _call_input_1d_tensors(self, input_1d_tensors, index, columns):
100         if len({t.shape for t in input_1d_tensors}) != 1:
--> 101             raise ValueError('input 1-d tensors should have same shape')
102
103         inputs = list(input_1d_tensors)

ValueError: input 1-d tensors should have same shape

# Fixed code
def _submit_operand_to_execute(self):
    self._semaphore.acquire()
    self._queue.wait()

    if self._has_error.is_set():
        # error happens, ignore
        return

    with self._lock:
        to_submit_op = self._queue.pop(0)
    assert to_submit_op.key not in self._submitted_op_keys
    self._submitted_op_keys.add(to_submit_op.key)

    if self._print_progress:
        i, n = len(self._submitted_op_keys), len(self._op_key_to_ops)
        if i % 30 or i >= n:
            logger.info(
                "[{0}] {1:.2f}% percent of graph has been submitted".format(
                    str(datetime.datetime.now()), float(i) * 100 / n
                )
            )

    if self._prefetch:
        # check the operand's outputs if any of its successor's predecessors can be prefetched
        self._prefetch_executor.submit(self._fetch_chunks, to_submit_op.outputs)
    # execute the operand and return future
    return self._operand_executor.submit(self._execute_operand, to_submit_op)